工程联调

This commit is contained in:
mashuai 2024-08-26 13:33:22 +08:00
parent 40b06e2039
commit 6d769fbf61
6 changed files with 82 additions and 63 deletions

View File

@ -36,19 +36,24 @@ public class BmProject extends BaseEntity implements Serializable {
@NotBlank(message = "工程名称不能为空")
private String name;
/**
* 实施单位
*/
@ApiModelProperty(value = "实施单位id")
@NotNull(message = "实施单位不能为空")
private Integer impUnit;
/**
* 实施单位
*/
@ApiModelProperty(value = "实施单位")
@Excel(name = "实施单位")
@NotBlank(message = "实施单位不能为空")
private String impUnit;
private String impUnitName;
/**
* 项目类型 1线路工程2:变电工程3:业务工程4:其他工程
*/
@ApiModelProperty(value = "项目类型。 1线路工程2:变电工程3:业务工程4:其他工程")
@Excel(name = "工程类型")
@Min(value = 1, message = "项目类型不能为空")
private Integer projectType;
@ -56,6 +61,7 @@ public class BmProject extends BaseEntity implements Serializable {
* 项目类型 1线路工程2:变电工程3:业务工程4:其他工程
*/
@ApiModelProperty(value = "工程类型名称")
@Excel(name = "工程类型")
private String projectTypeName;
/**
@ -122,13 +128,13 @@ public class BmProject extends BaseEntity implements Serializable {
*/
@ApiModelProperty(value = "工程状态")
@NotNull(message = "工程状态不能为空")
@Excel(name = "工程状态")
private Integer stats;
/**
* 工程状态
*/
@ApiModelProperty(value = "工程状态名称")
@Excel(name = "工程状态")
private String statsName;
/**

View File

@ -88,7 +88,7 @@ public class BmProjectController extends BaseController {
@PostMapping(value = "/add")
@RequiresPermissions("base:project:add")
public ResultBean<Boolean> add(@NotNull @Valid @RequestBody BmProject obj) {
if (this.bmProjectService.selectByName(obj.getName()) != 0) {
if (this.bmProjectService.selectByName(obj.getName()) != null) {
return ResultBean.error("工程名称重复");
}
int result = this.bmProjectService.insertSelective(obj);
@ -104,7 +104,7 @@ public class BmProjectController extends BaseController {
@PutMapping(value = "/update")
@RequiresPermissions("base:project:edit")
public ResultBean<Object> edit(@NotNull @Valid @RequestBody BmProject obj) {
if (this.bmProjectService.selectByName(obj.getName()) > 1) {
if (!this.bmProjectService.selectByName(obj.getName()).getId().equals(obj.getId())) {
return ResultBean.error("工程名称重复");
}
return ResultBean.toIsSuccess(this.bmProjectService.updateByPrimaryKeySelective(obj));
@ -130,12 +130,10 @@ public class BmProjectController extends BaseController {
*/
@PostMapping("/export")
@RequiresPermissions("base:project:export")
public void export(HttpServletResponse response, @RequestBody List<Integer> ids) {
List<BmProject> list = Optional.ofNullable(CollectionUtil.isEmpty(ids)
? bmProjectService.selectAll(new BmProject())
: bmProjectService.findAllInId(ids)).orElse(Collections.emptyList());
public void export(HttpServletResponse response, BmProject bmProject) {
List<BmProject> list = bmProjectService.selectAll(bmProject);
list.forEach(record -> {
record.setIsMatch(StringHelper.isNotEmpty(record.getIsMatch()) ? "匹配" : "不匹配");
record.setIsMatchI8(StringHelper.isNotEmpty(record.getProId()) ? "匹配" : "不匹配");
});
ExcelUtil<BmProject> util = new ExcelUtil<>(BmProject.class);
util.exportExcel(response, list, "工程管理数据");

View File

@ -48,7 +48,7 @@ public interface BmProjectMapper {
*/
BmProject selectByPrimaryKey(Integer id);
int selectByName(@Param("name")String name);
BmProject selectByName(@Param("name")String name);
List<BmProject> selectAll(BmProject bmProject);

View File

@ -64,7 +64,7 @@ public class BmProjectService{
}
public int selectByName(String name){
public BmProject selectByName(String name){
return bmProjectMapper.selectByName(name);
}

View File

@ -54,9 +54,23 @@
</select>
<select id="selectDeptTree" resultType="com.bonus.base.api.domain.SysDeptTree">
select d.dept_id as deptId, d.parent_id as parentId, d.ancestors, d.dept_name as deptName, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
where d.del_flag = '0' and d.status = '0'
SELECT
d.dept_id AS deptId,
d.parent_id AS parentId,
d.ancestors,
d.dept_name AS deptName,
d.order_num,
d.leader,
d.phone,
d.email,
d.status,
d.del_flag,
d.create_by,
d.create_time
FROM sys_dept d
WHERE d.del_flag = '0'
AND d.status = '0'
AND (LENGTH(d.ancestors) - LENGTH(REPLACE(d.ancestors, ',', ''))) + 1 != 3
</select>
<select id="selectCustomerByName" resultType="com.bonus.base.api.domain.BmCustomer">
select

View File

@ -22,7 +22,7 @@
<result column="lon" jdbcType="VARCHAR" property="lon" />
<result column="lat" jdbcType="VARCHAR" property="lat" />
<result column="company" jdbcType="VARCHAR" property="company" />
<result column="imp_unit" jdbcType="VARCHAR" property="impUnit" />
<result column="imp_unit" jdbcType="INTEGER" property="impUnit" />
<result column="dept_name" jdbcType="VARCHAR" property="deptName" />
<result column="pro_id" jdbcType="VARCHAR" property="proId" />
<result column="dept_id" jdbcType="INTEGER" property="deptId" />
@ -34,11 +34,11 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
bmp.id, bmp.project_type, sda1.dict_label AS projectTypeName, bmp.name, bmp.num, bmp.manager,bmp.nature,
bmp.id, bmp.project_type AS projectType, sda1.dict_label AS projectTypeName, bmp.name, bmp.num, bmp.manager,bmp.nature,
sda2.dict_label AS natureName, bmp.telphone, bmp.phone, bmp.fax, bmp.address,
bmp.remark, bmp.material_clerk, bmp.company_id, bmp.time,
bmp.is_active, bmp.lon, bmp.lat, bmp.company, bmp.imp_unit,
bmp.dept_name, bmp.pro_id, bmp.dept_id, bmp.cvo, bmp.stats, sda3.dict_label AS statsName,
bmp.is_active, bmp.lon, bmp.lat, bmp.company, bmp.imp_unit AS impUnit, sd.dept_name AS impUnitName,
bmp.dept_name, bmp.pro_id AS proId, bmp.dept_id, bmp.cvo, bmp.stats, sda3.dict_label AS statsName,
bmp.htzt, bmp.is_match
</sql>
@ -53,34 +53,7 @@
where is_active = '1' and id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from bm_project bmp
LEFT JOIN sys_dict_data sda1 ON bmp.project_type = sda1.dict_code
LEFT JOIN sys_dict_data sda2 ON bmp.nature = sda2.dict_code
LEFT JOIN sys_dict_data sda3 ON bmp.stats = sda3.dict_code
where is_active = '1'
<if test="name != null and name !=''">
and bmp.name LIKE CONCAT('%',#{name},'%')
</if>
<if test="projectType != null">
and bmp.project_type = #{projectType,jdbcType=INTEGER}
</if>
<if test="nature != null and nature != ''">
and bmp.nature = #{nature,jdbcType=VARCHAR}
</if>
<if test="stats != null and stats != ''">
and bmp.stats = #{stats,jdbcType=VARCHAR}
</if>
<if test="dataCondition != null and dataCondition.size()>0">
AND bmp.id in
<foreach collection="dataCondition" item="proId" index="index" open="(" separator="," close=")">
#{proId}
</foreach>
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
@ -279,22 +252,22 @@
<if test="nature != null and nature != ''">
nature = #{nature,jdbcType=VARCHAR},
</if>
<if test="telphone != null and telphone != ''">
<if test="telphone != null">
telphone = #{telphone,jdbcType=VARCHAR},
</if>
<if test="phone != null and phone != ''">
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="fax != null and fax != ''">
<if test="fax != null">
fax = #{fax,jdbcType=VARCHAR},
</if>
<if test="address != null and address != ''">
<if test="address != null ">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="remark != null and remark != ''">
<if test="remark != null ">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="materialClerk != null and materialClerk != ''">
<if test="materialClerk != null ">
material_clerk = #{materialClerk,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
@ -315,13 +288,13 @@
<if test="company != null and company != ''">
company = #{company,jdbcType=VARCHAR},
</if>
<if test="impUnit != null and impUnit != ''">
<if test="impUnit != null ">
imp_unit = #{impUnit,jdbcType=VARCHAR},
</if>
<if test="deptName != null and deptName != ''">
<if test="deptName != null ">
dept_name = #{deptName,jdbcType=VARCHAR},
</if>
<if test="proId != null and proId != ''">
<if test="proId != null ">
pro_id = #{proId,jdbcType=VARCHAR},
</if>
<if test="deptId != null">
@ -705,12 +678,6 @@
update bm_project set is_active = '0' where id = #{id,jdbcType=INTEGER}
</update>
<!--by syruan on 2024-08-14-->
<select id="selectByName" resultType="java.lang.Integer">
select count(*)
from bm_project
where `name`= #{name,jdbcType=VARCHAR}
</select>
<!--by syruan on 2024-08-15-->
<select id="findAllInId" resultMap="BaseResultMap">
@ -722,4 +689,38 @@
#{item,jdbcType=INTEGER}
</foreach>
</select>
<select id="selectAll" resultType="com.bonus.base.api.domain.BmProject">
select
<include refid="Base_Column_List" />
from bm_project bmp
LEFT JOIN sys_dict_data sda1 ON bmp.project_type = sda1.dict_code
LEFT JOIN sys_dict_data sda2 ON bmp.nature = sda2.dict_code
LEFT JOIN sys_dict_data sda3 ON bmp.stats = sda3.dict_code
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
where is_active = '1'
<if test="name != null and name !=''">
and bmp.name LIKE CONCAT('%',#{name},'%')
</if>
<if test="projectType != null">
and bmp.project_type = #{projectType,jdbcType=INTEGER}
</if>
<if test="nature != null and nature != ''">
and bmp.nature = #{nature,jdbcType=VARCHAR}
</if>
<if test="stats != null and stats != ''">
and bmp.stats = #{stats,jdbcType=VARCHAR}
</if>
<if test="dataCondition != null and dataCondition.size()>0">
AND bmp.id in
<foreach collection="dataCondition" item="proId" index="index" open="(" separator="," close=")">
#{proId}
</foreach>
</if>
</select>
<select id="selectByName" resultType="com.bonus.base.api.domain.BmProject">
select
id, `name`, is_active
from bm_project
where is_active = '1'and name = #{name}
</select>
</mapper>