代码提交

This commit is contained in:
itcast 2025-12-09 17:04:44 +08:00
parent 3c1c61fc5a
commit 5b091d5ec5
6 changed files with 55 additions and 16 deletions

View File

@ -57,4 +57,7 @@ public class Project {
//
private String county;
//备注
private String remark;
}

View File

@ -56,4 +56,8 @@ public interface ProjectMapper {
public List<ProjectType> selectProjectTypeList();
public int delProjectBatch(List<Long> ids);
int countByProjectName(String proName);
int countByProjectCode(String proCode);
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.project.service.impl;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.project.domain.Project;
import com.bonus.material.project.domain.ProjectType;
import com.bonus.material.project.mapper.ProjectMapper;
@ -60,6 +61,16 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public void insertProject(Project project)
{
int count = projectMapper.countByProjectName(project.getPro_name());
if (count > 0) {
throw new RuntimeException("工程名称已存在,请勿重复新增");
}
int count1 =projectMapper.countByProjectCode(project.getPro_code());
if(count1>0){
throw new RuntimeException("工程编号已存在,请勿重复新增");
}
project.setProvince(regionMapper.getShortNameByCode(project.getProvince()));
project.setCity(regionMapper.getShortNameByCode(project.getCity()));
project.setCounty(regionMapper.getNameByCode(project.getCounty()));
@ -74,6 +85,11 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public void updateProject(Project project)
{
int count =projectMapper.countByProjectName(project.getPro_name());
if(count>0){
throw new RuntimeException("工程名称已存在,请重新修改");
}
project.setProvince(regionMapper.getShortNameByCode(project.getProvince()));
project.setCity(regionMapper.getShortNameByCode(project.getCity()));
project.setCounty(regionMapper.getNameByCode(project.getCounty()));

View File

@ -54,7 +54,7 @@
<!-- 通过ID查询工程 -->
<select id="selectProjectById" resultMap="ProjectResult">
select
id, pro_code, pro_name, voltage,scale, project_type,org_name, province, city, county,mechanize_rate,start_time, put_time ,sdd.dict_label
id, pro_code, pro_name, voltage,scale, project_type,org_name, province, city, county,mechanize_rate,start_time, put_time ,sdd.dict_label,jsp.remark
from
jj_sing_project jsp
left join sys_dict_data sdd on sdd.dict_value = jsp.project_type and sdd.dict_type='bm_project_type'
@ -77,7 +77,8 @@
province,
city,
county,
mechanize_rate)
mechanize_rate,
remark)
values (#{pro_code},
#{pro_name},
#{voltage},
@ -89,7 +90,8 @@
#{province},
#{city},
#{county},
#{mechanize_rate})
#{mechanize_rate},
#{remark})
</insert>
<!-- 修改工程 -->
@ -132,6 +134,9 @@
<if test="put_time != null ">
put_time = #{put_time},
</if>
<if test="remark != null ">
remark = #{remark},
</if>
</set>
where id = #{id}
</update>
@ -162,4 +167,15 @@
dict_value asc
</select>
<select id="countByProjectName" resultType="java.lang.Integer">
select count(*)
from jj_sing_project
where pro_name = #{pro_name}
</select>
<select id="countByProjectCode" resultType="java.lang.Integer">
select count(*)
from jj_sing_project
where pro_code = #{pro_code}
</select>
</mapper>

View File

@ -126,7 +126,7 @@
mdi.item_type_model As specificationModel,
mdi.code AS code,
mdi.up_down_status AS upDownStatus,
mdi.change_status AS status,
mdi.ma_status AS status,
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
jsp.pro_code AS usingProjectId,
jsp.pro_name AS usingProject,

View File

@ -67,16 +67,16 @@
AND tt3.del_flag = '0'
AND tt4.del_flag = '0'
and tl.id is not null
<if test="fourthParentId != null and fourthParentId != ''">
<if test="fourthParentName != null and fourthParentName != ''">
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
</if>
<if test="greatGrandparentId != null and greatGrandparentId != ''">
<if test="greatGrandparentName != null and greatGrandparentName != ''">
AND tt3.type_name LIKE CONCAT('%', #{greatGrandparentName}, '%')
</if>
<if test="grandparentTypeId != null and grandparentTypeId != ''">
<if test="grandparentTypeName != null and grandparentTypeName != ''">
AND tt2.type_name LIKE CONCAT('%', #{grandparentTypeName}, '%')
</if>
<if test="parentTypeId != null and parentTypeId != ''">
<if test="parentTypeName != null and parentTypeName != ''">
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
</if>
<if test="typeName != null and typeName != ''">
@ -124,16 +124,16 @@
AND tt2.del_flag = '0'
AND tt3.del_flag = '0'
AND tt4.del_flag = '0'
<if test="fourthParentId != null and fourthParentId != ''">
<if test="fourthParentName != null and fourthParentName != ''">
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
</if>
<if test="greatGrandparentId != null and greatGrandparentId != ''">
<if test="greatGrandparentName != null and greatGrandparentName != ''">
AND tt3.type_name LIKE CONCAT('%', #{greatGrandparentName}, '%')
</if>
<if test="grandparentTypeId != null and grandparentTypeId != ''">
<if test="grandparentTypeName != null and grandparentTypeName != ''">
AND tt2.type_name LIKE CONCAT('%', #{grandparentTypeName}, '%')
</if>
<if test="parentTypeId != null and parentTypeId != ''">
<if test="parentTypeName != null and parentTypeName != ''">
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
</if>
<if test="typeName != null and typeName != ''">
@ -189,16 +189,16 @@
AND tt2.del_flag = '0'
AND tt3.del_flag = '0'
AND tt4.del_flag = '0'
<if test="fourthParentId != null and fourthParentId != ''">
<if test="fourthParentName != null and fourthParentName != ''">
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
</if>
<if test="greatGrandparentId != null and greatGrandparentId != ''">
<if test="greatGrandparentName != null and greatGrandparentName != ''">
AND tt3.type_name LIKE CONCAT('%', #{greatGrandparentName}, '%')
</if>
<if test="grandparentTypeId != null and grandparentTypeId != ''">
<if test="grandparentTypeName != null and grandparentTypeName != ''">
AND tt2.type_name LIKE CONCAT('%', #{grandparentTypeName}, '%')
</if>
<if test="parentTypeId != null and parentTypeId != ''">
<if test="parentTypeName != null and parentTypeName != ''">
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
</if>
<if test="typeName != null and typeName != ''">