基础管理页面完成

This commit is contained in:
zhulongchuan 2025-09-16 19:39:06 +08:00
parent ecf79535ae
commit 52364c7265
6 changed files with 97 additions and 36 deletions

View File

@ -51,14 +51,14 @@ public class EquInfoController extends BaseController {
@Log(title = "设备台账导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EquInfoExportVo equInfoExportVo) {
public void export(HttpServletResponse response,EquInfoEntity equInfoEntity) {
// SysUser sysUser = userService.getUserInfoByUserId(SecurityUtils.getUserId(), SecurityConstants.INNER).getData();
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
Long deptId = sysUser.getDeptId();
// equInfoExportVo.setOrgIds(Arrays.asList(ServletUtils.urlDecode(String.valueOf(deptId)).split(",")).stream().map(x -> Long.parseLong(x)).collect(Collectors.toList()));
equInfoExportVo.setDeptId(deptId);
List<EquInfoExportDto> list = equInfoService.selectEquInfoExportList(equInfoExportVo);
ExcelUtil<EquInfoExportDto> util = new ExcelUtil<EquInfoExportDto>(EquInfoExportDto.class);
equInfoEntity.setDeptId(deptId);
List<EquInfoEntity> list = equInfoService.selectEquInfoExportList(equInfoEntity);
ExcelUtil<EquInfoEntity> util = new ExcelUtil<EquInfoEntity>(EquInfoEntity.class);
util.exportExcel(response, list, "设备台账");
}
@ -165,6 +165,8 @@ public class EquInfoController extends BaseController {
if (equInfoEntity != null) {
return new AjaxResult(500, "该组织下设备序列号重复,请先修改序列号");
}
Long orgId = vo.getDeptId();
vo.setOrganId(orgId);
if (vo.getEquId() == null) {
vo.setCreateBy(SecurityUtils.getUsername());
return toAjax(equInfoService.saves(vo));
@ -182,8 +184,8 @@ public class EquInfoController extends BaseController {
}
@DeleteMapping
public AjaxResult delete(@Validated @RequestBody String[] equIds) {
@DeleteMapping("/{equIds}")
public AjaxResult delete(@PathVariable String[] equIds) {
//equInfoService.delete(equIds);
equInfoService.updateEquInfoByIds(equIds);
return success();

View File

@ -160,6 +160,8 @@ public class EquInfoEntity extends BaseEntity {
*/
private String updateBy;
private Long deptId;
/**
* 修改时间
*/

View File

@ -51,7 +51,7 @@ public interface EquInfoMapper
EquInfoEntity selectEquInfoByEquSn(EquInfoEntity equInfoEntity);
List<EquInfoExportDto> selectEquInfoExportList(EquInfoExportVo equInfoExportVo);
List<EquInfoEntity> selectEquInfoExportList(EquInfoEntity equInfoEntity);
EquInfoEntity selectEquInfoByTypeId(@Param("typeId") String typeId,@Param("deptId") String deptId);
}

View File

@ -54,7 +54,7 @@ public interface EquInfoService {
EquInfoEntity selectEquInfoByEquSn(EquInfoEntity vo);
List<EquInfoExportDto> selectEquInfoExportList(EquInfoExportVo equInfoExportVo);
List<EquInfoEntity> selectEquInfoExportList(EquInfoEntity equInfoEntity);
String importData(List<EquInfoExportDto> userList, Boolean isUpdateSupport) throws ServiceException;

View File

@ -202,6 +202,9 @@ public class EquInfoServiceImpl implements EquInfoService {
List<String> collect = sysDictDataList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
boolean b = false;
for (String s : collect) {
if (dept.getAdminCode() ==null){
break;
}
if (s.contains(dept.getAdminCode().substring(0, 6).trim())) {
b = true;
break;
@ -512,17 +515,17 @@ public class EquInfoServiceImpl implements EquInfoService {
}
@Override
public List<EquInfoExportDto> selectEquInfoExportList(EquInfoExportVo equInfoExportVo) {
List<EquInfoExportDto> equInfoExportDtos = equInfoMapper.selectEquInfoExportList(equInfoExportVo);
for (EquInfoExportDto equInfoExportDto : equInfoExportDtos) {
public List<EquInfoEntity> selectEquInfoExportList(EquInfoEntity equInfoEntity) {
List<EquInfoEntity> equInfoExportDtos = equInfoMapper.selectEquInfoExportList(equInfoEntity);
for (EquInfoEntity equInfoExportDto : equInfoExportDtos) {
// R<SysDept> data = sysDeptService.getDeptInfo(Long.valueOf(equInfoExportDto.getOrganId()), "inner");
// SysDept sysDept = data.getData();
SysDept sysDept = sysDeptService.selectDeptById(Long.valueOf(equInfoExportDto.getOrganId()));
if (sysDept != null) {
equInfoExportDto.setOrganId(sysDept.getDeptName());
equInfoExportDto.setDeptName(sysDept.getDeptName());
} else {
equInfoExportDto.setOrganId(null);
equInfoExportDto.setDeptName(null);
}
EquType equType = equTypeMapper.selectEquTypeByTypeId(equInfoExportDto.getTypeId());

View File

@ -13,6 +13,7 @@
<result property="equSn" column="equ_sn" jdbcType="VARCHAR"/>
<result property="gbCode" column="gb_code" jdbcType="VARCHAR"/>
<result property="organId" column="organ_id" jdbcType="BIGINT"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
<result property="mngName" column="mng_name" jdbcType="VARCHAR"/>
<result property="mngCode" column="mng_code" jdbcType="VARCHAR"/>
<result property="purDate" column="pur_date" jdbcType="VARCHAR"/>
@ -132,15 +133,33 @@
AND (equ.organ_id = #{organId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{organId}, ancestors) ))
</if>
<if test="deptId != null and deptId != 0">
AND (equ.organ_id = #{deptId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{deptId}, ancestors) ))
</if>
</where>
order by equ_code desc
</select>
<!-- <select id="selectEquInfoById" parameterType="String" resultMap="EquInfoEntityResult">-->
<!-- <include refid="selectEquInfoVo"/>-->
<!-- where equ_id = #{equId}-->
<!-- </select>-->
<select id="selectEquInfoById" parameterType="String" resultMap="EquInfoEntityResult">
<include refid="selectEquInfoVo"/>
select equ.equ_id,equ.equ_code,equ.type_id,equ.gb_code,
equ.model_id,equ.equ_sts,equ.equ_sn,
equ.organ_id,equ.mng_name,equ.mng_code,
equ.pur_date,equ.mtn_date,equ.loc_lon,
equ.loc_lat,equ.create_by,equ.create_time,equ.classify,equ.equ_load,equ.remark,equ.insurance_url,
equ.remark,equ.attribution,equ.equ_function,equ.equ_type,equ.range_rad,equ.spacial_function,
equ.update_by,equ.update_time,dept.dept_name,dept.dept_id,type.type_name
from equ_info equ left join sys_dept dept on equ.organ_id = dept.dept_id
left join equ_type type on equ.type_id=type.type_id
where equ_id = #{equId}
</select>
<select id="selectEquInfoByEquSn" parameterType="com.djhk.uav.equ.domain.EquInfoEntity" resultMap="EquInfoEntityResult">
<include refid="selectEquInfoVo"/>
where equ_sn = #{equSn} and organ_id = #{organId}
@ -308,35 +327,70 @@
AND (equ.organ_id = #{deptId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{deptId}, ancestors) ))
</select>
<select id="selectEquInfoExportList" resultType="com.djhk.uav.equ.domain.dto.EquInfoExportDto">
<include refid="selectEquInfoVo"/>
<select id="selectEquInfoExportList" parameterType="com.djhk.uav.equ.domain.EquInfoEntity"
resultMap="EquInfoEntityResult">
<include refid="selectEquInfoAndOthers"/>
<where>
and equ.del_flag = "0"
<if test="ids != null and ids.size() > 0">
and id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
and equ.del_flag = '0'
<if test="modelId != null and modelId != ''">
AND equ.model_id like concat('%' , #{modelId}, '%')
</if>
<if test="createBy != null and createBy != '' ">
AND equ.create_by like concat('%',#{createBy},'%')
<if test="equCode != null and equCode != ''">
AND equ.equ_code like concat('%' , #{equCode}, '%')
</if>
<if test="typeId != null and typeId != ''">
AND equ.type_id = #{typeId}
</if>
<if test="deptId != null and deptId != '' ">
AND equ.organ_id in (select dept_id from sys_dept WHERE dept_id = #{deptId} OR FIND_IN_SET(#{deptId}, ancestors))
<if test="modelId != null and modelId != ''">
AND equ.model_id like concat('%' , #{modelId}, '%')
</if>
<if test="equSn != null and equSn != ''">
AND equ.equ_sn like concat('%', #{equSn}, '%')
</if>
<if test="mngName != null and mngName != ''">
AND equ.mng_name like concat('%', #{mngName}, '%')
</if>
<if test="organId != null and organId != 0">
AND (equ.organ_id = #{organId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{organId}, ancestors) ))
</if>
<if test="deptId != null and deptId != 0">
AND (equ.organ_id = #{deptId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{deptId}, ancestors) ))
</if>
<!--<if test="orgIds != null and orgIds.size() > 0">
and organ_id in
<foreach collection="orgIds" item="item" open="(" separator="," close=")">
#{item}
/*select * from sys_dept d WHERE dept_id = 53569 OR FIND_IN_SET(53569, ancestors)*/
</foreach>
</if>-->
</where>
order by equ.create_Time desc
order by equ_code desc
</select>
<!-- <select id="selectEquInfoExportList" resultType="com.djhk.uav.equ.domain.dto.EquInfoExportDto">-->
<!-- <include refid="selectEquInfoVo"/>-->
<!-- <where>-->
<!-- and equ.del_flag = "0"-->
<!-- <if test="ids != null and ids.size() > 0">-->
<!-- and id in-->
<!-- <foreach item="id" collection="ids" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="createBy != null and createBy != '' ">-->
<!-- AND equ.create_by like concat('%',#{createBy},'%')-->
<!-- </if>-->
<!-- <if test="typeId != null and typeId != '' ">-->
<!-- AND equ.type_id = #{typeId}-->
<!-- </if>-->
<!-- <if test="deptId != null and deptId != '' ">-->
<!-- AND equ.organ_id in (select dept_id from sys_dept WHERE dept_id = #{deptId} OR FIND_IN_SET(#{deptId}, ancestors))-->
<!-- </if>-->
<!-- &lt;!&ndash;<if test="orgIds != null and orgIds.size() > 0">-->
<!-- and organ_id in-->
<!-- <foreach collection="orgIds" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- /*select * from sys_dept d WHERE dept_id = 53569 OR FIND_IN_SET(53569, ancestors)*/-->
<!-- </foreach>-->
<!-- </if>&ndash;&gt;-->
<!-- </where>-->
<!-- order by equ.create_Time desc-->
<!-- </select>-->
<select id="selectEquInfoByTypeId" resultType="com.djhk.uav.equ.domain.EquInfoEntity">
select equ.equ_id,equ.equ_code,equ.type_id,equ.gb_code,
equ.model_id,equ.equ_sts,equ.equ_sn,