代码优化

This commit is contained in:
马三炮 2025-04-14 15:00:35 +08:00
parent 99501cbdea
commit c9d58da3af
5 changed files with 23 additions and 47 deletions

View File

@ -134,6 +134,9 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
String CreateUserName = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getUsername(): null; String CreateUserName = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getUsername(): null;
data.setUpdateUserId(CreateUserId); data.setUpdateUserId(CreateUserId);
data.setUpdateUserName(CreateUserName); data.setUpdateUserName(CreateUserName);
if (data.getTime().isEmpty()){
data.setTime(null);
}
importantMatterMapper.updateImportantMatter(data); importantMatterMapper.updateImportantMatter(data);
//附件先删除后新增 //附件先删除后新增
sysFileResourceService.deleteFileResource(data.getId()); sysFileResourceService.deleteFileResource(data.getId());

View File

@ -137,6 +137,9 @@ public class SafetyMeasuresServiceImpl implements SafetyMeasuresService {
String CreateUserName = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getUsername(): null; String CreateUserName = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getUsername(): null;
data.setUpdateUserId(CreateUserId); data.setUpdateUserId(CreateUserId);
data.setUpdateUserName(CreateUserName); data.setUpdateUserName(CreateUserName);
if (data.getCheckDate().isEmpty()){
data.setCheckDate(null);
}
//修改 //修改
safetyMeasuresMapper.updateSafetyMeasures(data); safetyMeasuresMapper.updateSafetyMeasures(data);
//附件先删除后新增 //附件先删除后新增
@ -153,6 +156,12 @@ public class SafetyMeasuresServiceImpl implements SafetyMeasuresService {
//修改综合查询 //修改综合查询
ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo(); ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo();
BeanUtils.copyProperties(data,comprehensiveQueryVo); BeanUtils.copyProperties(data,comprehensiveQueryVo);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (data.getCheckDate() != null && !data.getCheckDate().trim().isEmpty()) {
comprehensiveQueryVo.setRectDate(dateFormat.parse(data.getCheckDate()));
}
comprehensiveQueryVo.setVioPlace(data.getCheckPlace());
comprehensiveQueryVo.setVioDesc(data.getCheckDesc());
synthesisQueryService.updateComprehensiveQuery(comprehensiveQueryVo); synthesisQueryService.updateComprehensiveQuery(comprehensiveQueryVo);
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString(), e); log.error(e.toString(), e);

View File

@ -47,22 +47,10 @@
</insert> </insert>
<update id="updateCoordinatePhoto"> <update id="updateCoordinatePhoto">
update tb_coordinate_photo update tb_coordinate_photo set pro_id = #{proId},pro_name = #{proName},gx_id = #{gxId},gx_name = #{gxName},
<trim prefix="SET" suffixOverrides=","> build_place = #{buildPlace},build_before_desc = #{buildBeforeDesc},build_under_desc = #{buildUnderDesc},
<if test="proId != null and proId != ''">pro_id = #{proId},</if> build_after_desc = #{buildAfterDesc},update_user_id = #{updateUserId},update_user_name = #{updateUserName},
<if test="proName != null and proName != ''">pro_name = #{proName},</if> major_name = #{majorName},major_id = #{majorId},update_time = NOW()
<if test="majorId != null and majorId != ''">major_id = #{majorId},</if>
<if test="majorName != null and majorName != ''">major_name = #{majorName},</if>
<if test="gxId != null and gxId != ''">gx_id = #{gxId},</if>
<if test="gxName != null and gxName != ''">gx_name = #{gxName},</if>
<if test="buildPlace != null and buildPlace != ''">build_place = #{buildPlace},</if>
<if test="buildBeforeDesc != null ">build_before_desc = #{buildBeforeDesc},</if>
<if test="buildUnderDesc != null ">build_under_desc = #{buildUnderDesc},</if>
<if test="buildAfterDesc != null ">build_after_desc = #{buildAfterDesc},</if>
<if test="updateUserId != null and updateUserId != ''">update_user_id = #{updateUserId},</if>
<if test="updateUserName != null and updateUserName != ''">update_user_name = #{updateUserName},</if>
update_time = NOW()
</trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -46,21 +46,10 @@
</insert> </insert>
<update id="updateImportantMatter"> <update id="updateImportantMatter">
update tb_main_matter_publicize_photo update tb_main_matter_publicize_photo set pro_id = #{proId},pro_name = #{proName},major_id = #{majorId},
<trim prefix="SET" suffixOverrides=","> major_name = #{majorName},gx_id = #{gxId},gx_name = #{gxName},time = #{time},
<if test="proId != null and proId != ''">pro_id = #{proId},</if> title = #{title},content = #{content},
<if test="proName != null and proName != ''">pro_name = #{proName},</if> update_user_id = #{updateUserId},update_user_name = #{updateUserName},update_time = NOW()
<if test="majorId != null and majorId != ''">major_id = #{majorId},</if>
<if test="majorName != null and majorName != ''">major_name = #{majorName},</if>
<if test="gxId != null and gxId != ''">gx_id = #{gxId},</if>
<if test="gxName != null and gxName != ''">gx_name = #{gxName},</if>
<if test="time != null and time != ''">time = #{time},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="updateUserId != null and updateUserId != ''">update_user_id = #{updateUserId},</if>
<if test="updateUserName != null and updateUserName != ''">update_user_name = #{updateUserName},</if>
update_time = NOW()
</trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -47,22 +47,9 @@
</insert> </insert>
<update id="updateSafetyMeasures"> <update id="updateSafetyMeasures">
update tb_safety_measure update tb_safety_measure set pro_id = #{proId},pro_name = #{proName},major_id = #{majorId},major_name = #{majorName},
<trim prefix="SET" suffixOverrides=","> gx_id = #{gxId},gx_name = #{gxName},check_user_name = #{checkUserName},check_date = #{checkDate},check_place = #{checkPlace},
<if test="proId != null and proId != ''">pro_id = #{proId},</if> check_desc = #{checkDesc},update_user_id = #{updateUserId},update_user_name = #{updateUserName},update_time = NOW()
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="majorId != null and majorId != ''">major_id = #{majorId},</if>
<if test="majorName != null and majorName != ''">major_name = #{majorName},</if>
<if test="gxId != null and gxId != ''">gx_id = #{gxId},</if>
<if test="gxName != null and gxName != ''">gx_name = #{gxName},</if>
<if test="checkUserName != null and checkUserName != ''">check_user_name = #{checkUserName},</if>
<if test="checkDate != null and checkDate != ''">check_date = #{checkDate},</if>
<if test="checkPlace != null and checkPlace != ''">check_place = #{checkPlace},</if>
<if test="checkDesc != null and checkDesc != ''">check_desc = #{checkDesc},</if>
<if test="updateUserId != null and updateUserId != ''">update_user_id = #{updateUserId},</if>
<if test="updateUserName != null and updateUserName != ''">update_user_name = #{updateUserName},</if>
update_time = NOW()
</trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteSafetyMeasures"> <delete id="deleteSafetyMeasures">