From 62d04ddc32ef307899aeac8a4a9696d759aea885 Mon Sep 17 00:00:00 2001 From: liuxm <liuxm@fescotech.com> Date: 星期四, 09 五月 2024 17:06:45 +0800 Subject: [PATCH] 不合格原因,报废原因管理 --- pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml | 2 pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml | 129 ++++++++ pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURSv.java | 74 ++++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java | 3 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java | 132 ++++++++ pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRSv.java | 74 ++++ pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java | 133 ++++++++ pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/QueryVo.java | 18 + pms-parent/pms-global/src/main/resources/mapper/PltProductUnqualifiedReasonMapper.xml | 129 ++++++++ pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/QueryVo.java | 18 + pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductUnqualifiedReasonMapper.java | 36 ++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductScrappingReasonMapper.java | 36 ++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductScrappingReason.java | 51 +++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductUnqualifiedReason.java | 50 +++ pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 2 15 files changed, 883 insertions(+), 4 deletions(-) diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductScrappingReasonMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductScrappingReasonMapper.java new file mode 100644 index 0000000..d7223c6 --- /dev/null +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductScrappingReasonMapper.java @@ -0,0 +1,36 @@ +package com.dy.pmsGlobal.daoPlt; + +import com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** +* @author 灏忔槑 +* @description 閽堝琛ㄣ�恜lt_product_scrapping_reason(浜у搧璁惧鎶ュ簾鍘熷洜琛�)銆戠殑鏁版嵁搴撴搷浣淢apper +* @createDate 2024-05-07 13:46:45 +* @Entity com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason +*/ +@Mapper +public interface PltProductScrappingReasonMapper { + + int deleteByPrimaryKey(Long id); + + int insert(PltProductScrappingReason record); + + int insertSelective(PltProductScrappingReason record); + + PltProductScrappingReason selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(PltProductScrappingReason record); + + int updateByPrimaryKey(PltProductScrappingReason record); + + Long selectSomeCount(Map<String,Object> params); + + List<PltProductScrappingReason> selectSome(Map<String,Object> params); + + int deleteLogicById(Long id); + +} diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductUnqualifiedReasonMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductUnqualifiedReasonMapper.java new file mode 100644 index 0000000..dcab343 --- /dev/null +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductUnqualifiedReasonMapper.java @@ -0,0 +1,36 @@ +package com.dy.pmsGlobal.daoPlt; + +import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** +* @author 灏忔槑 +* @description 閽堝琛ㄣ�恜lt_product_unqualified_reason(浜у搧鐢熶骇涓嶅悎鏍煎師鍥犺〃)銆戠殑鏁版嵁搴撴搷浣淢apper +* @createDate 2024-05-07 13:46:46 +* @Entity com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason +*/ +@Mapper +public interface PltProductUnqualifiedReasonMapper { + + int deleteByPrimaryKey(Long id); + + int insert(PltProductUnqualifiedReason record); + + int insertSelective(PltProductUnqualifiedReason record); + + PltProductUnqualifiedReason selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(PltProductUnqualifiedReason record); + + int updateByPrimaryKey(PltProductUnqualifiedReason record); + + Long selectSomeCount(Map<String,Object> params); + + List<PltProductUnqualifiedReason> selectSome(Map<String,Object> params); + + int deleteLogicById(Long id); + +} diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java index 33a1992..d1ed9fd 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java @@ -9,7 +9,6 @@ import jakarta.validation.constraints.NotNull; import lombok.*; -import java.io.Serializable; /** * 浜у搧鍝佽川妫�鏌ラ」鐩〃 @@ -21,7 +20,7 @@ @ToString @NoArgsConstructor @AllArgsConstructor -public class PltProductQualityInspectionItems implements Serializable { +public class PltProductQualityInspectionItems{ /** * */ diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductScrappingReason.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductScrappingReason.java new file mode 100644 index 0000000..4cafd47 --- /dev/null +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductScrappingReason.java @@ -0,0 +1,51 @@ +package com.dy.pmsGlobal.pojoPlt; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * 浜у搧璁惧鎶ュ簾鍘熷洜琛� + * @TableName plt_product_scrapping_reason + */ +@TableName(value="plt_product_scrapping_reason", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class PltProductScrappingReason{ + /** + * + */ + @TableId(type = IdType.AUTO) + public Long id; + + /** + * 浜у搧瀹炰綋缂栧彿 + */ + @NotNull(message = "浜у搧瀹炰綋缂栧彿涓嶈兘涓虹┖") + public Long proId; + + /** + * 浜у搧鍚嶇О + */ + @TableField(exist = false) + public String proName; + + /** + * 鎶ュ簾鍘熷洜 + */ + @NotEmpty(message = "鎶ュ簾鍘熷洜涓嶈兘涓虹┖") + public String reason; + + /** + * 鏄惁鍒犻櫎锛�1鏄紝0鍚� + */ + public Boolean deleted; + +} \ No newline at end of file diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductUnqualifiedReason.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductUnqualifiedReason.java new file mode 100644 index 0000000..b9d8d1a --- /dev/null +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductUnqualifiedReason.java @@ -0,0 +1,50 @@ +package com.dy.pmsGlobal.pojoPlt; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * 浜у搧鐢熶骇涓嶅悎鏍煎師鍥犺〃 + * @TableName plt_product_unqualified_reason + */ +@TableName(value="plt_product_unqualified_reason", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class PltProductUnqualifiedReason{ + /** + * + */ + @TableId(type = IdType.AUTO) + public Long id; + + /** + * 浜у搧瀹炰綋缂栧彿 + */ + @NotNull(message = "浜у搧瀹炰綋缂栧彿涓嶈兘涓虹┖") + public Long proId; + /** + * 浜у搧鍚嶇О + */ + @TableField(exist = false) + public String proName; + + /** + * 涓嶅悎鏍煎師鍥� + */ + @NotEmpty(message = "涓嶅悎鏍煎師鍥犱笉鑳戒负绌�") + public String reason; + + /** + * 鏄惁鍒犻櫎锛�1鏄紝0鍚� + */ + public Boolean deleted; + +} \ No newline at end of file diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml index 0cca318..eb9dff3 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml @@ -14,7 +14,7 @@ <result column="dt" jdbcType="TIMESTAMP" property="dt" /> <result column="remark" jdbcType="VARCHAR" property="remark" /> <association property="directorName" column="director" javaType="java.lang.Long" - select="selectNameById" /> + select="selectNameById" fetchType="eager" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml index 49dde20..5f127d2 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml @@ -10,7 +10,7 @@ <result property="item" column="item" jdbcType="VARCHAR"/> <result property="deleted" column="deleted" jdbcType="TINYINT"/> <association property="proName" column="pro_id" javaType="java.lang.Long" - select="selectProNameById" /> + select="selectProNameById" fetchType="eager" /> </resultMap> <sql id="Base_Column_List"> diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml new file mode 100644 index 0000000..3b196b6 --- /dev/null +++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pmsGlobal.daoPlt.PltProductScrappingReasonMapper"> + + <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason"> + <id property="id" column="id" jdbcType="BIGINT"/> + <result property="proId" column="pro_id" jdbcType="BIGINT"/> + <result property="reason" column="reason" jdbcType="VARCHAR"/> + <result property="deleted" column="deleted" jdbcType="TINYINT"/> + <association property="proName" column="pro_id" javaType="java.lang.Long" + select="selectProNameById" fetchType="eager" /> + </resultMap> + + <sql id="Base_Column_List"> + id,pro_id,reason, + deleted + </sql> + <sql id="part_Column_List"> + ${alias}.id, + ${alias}.pro_id, + ${alias}.reason, + ${alias}.deleted + </sql> + <select id="selectProNameById" parameterType="java.lang.Long" resultType="java.lang.String"> + select name proName from plt_product where id=#{id} + </select> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + select + <include refid="Base_Column_List" /> + from plt_product_scrapping_reason + where id = #{id,jdbcType=BIGINT} + </select> + + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + delete from plt_product_scrapping_reason + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason" useGeneratedKeys="true"> + insert into plt_product_scrapping_reason + ( id,pro_id,reason + ,deleted) + values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{reason,jdbcType=VARCHAR} + ,#{deleted,jdbcType=TINYINT}) + </insert> + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason" useGeneratedKeys="true"> + insert into plt_product_scrapping_reason + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="proId != null">pro_id,</if> + <if test="reason != null">reason,</if> + <if test="deleted != null">deleted,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null">#{id,jdbcType=BIGINT},</if> + <if test="proId != null">#{proId,jdbcType=BIGINT},</if> + <if test="reason != null">#{reason,jdbcType=VARCHAR},</if> + <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason"> + update plt_product_scrapping_reason + <set> + <if test="proId != null"> + pro_id = #{proId,jdbcType=BIGINT}, + </if> + <if test="reason != null"> + reason = #{reason,jdbcType=VARCHAR}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason"> + update plt_product_scrapping_reason + set + pro_id = #{proId,jdbcType=BIGINT}, + reason = #{reason,jdbcType=VARCHAR}, + deleted = #{deleted,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <select id="selectSome" resultMap="BaseResultMap"> + select + <include refid="part_Column_List" > + <property name="alias" value="t"/> + </include> + from plt_product_scrapping_reason t + inner join plt_product p on t.pro_id = p.id + where t.deleted!=1 + <trim prefix="and" suffixOverrides="and"> + <if test="proName != null and proName != ''"> + p.name like concat('%', #{proName}, '%') and + </if> + <if test="reason != null and reason != ''"> + t.reason like concat('%', #{reason}, '%') and + </if> + </trim> + order by id desc + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start}, #{count} + </if> + </trim> + </select> + + <select id="selectSomeCount" resultType="java.lang.Long"> + select count(1) + from plt_product_scrapping_reason t + inner join plt_product p on t.pro_id = p.id + where t.deleted!=1 + <trim prefix="and" suffixOverrides="and"> + <if test="proName != null and proName != ''"> + p.name like concat('%', #{proName}, '%') and + </if> + <if test="reason != null and reason != ''"> + t.reason like concat('%', #{reason}, '%') and + </if> + </trim> + </select> + + <update id="deleteLogicById" parameterType="java.lang.Long"> + update plt_product_scrapping_reason set deleted = 1 + where id = #{id} + </update> +</mapper> diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductUnqualifiedReasonMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductUnqualifiedReasonMapper.xml new file mode 100644 index 0000000..7f5b4b2 --- /dev/null +++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductUnqualifiedReasonMapper.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pmsGlobal.daoPlt.PltProductUnqualifiedReasonMapper"> + + <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason"> + <id property="id" column="id" jdbcType="BIGINT"/> + <result property="proId" column="pro_id" jdbcType="BIGINT"/> + <result property="reason" column="reason" jdbcType="VARCHAR"/> + <result property="deleted" column="deleted" jdbcType="TINYINT"/> + <association property="proName" column="pro_id" javaType="java.lang.Long" + select="selectProNameById" fetchType="eager" /> + </resultMap> + + <sql id="Base_Column_List"> + id,pro_id,reason, + deleted + </sql> + <sql id="part_Column_List"> + ${alias}.id, + ${alias}.pro_id, + ${alias}.reason, + ${alias}.deleted + </sql> + <select id="selectProNameById" parameterType="java.lang.Long" resultType="java.lang.String"> + select name proName from plt_product where id=#{id} + </select> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + select + <include refid="Base_Column_List" /> + from plt_product_unqualified_reason + where id = #{id,jdbcType=BIGINT} + </select> + + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + delete from plt_product_unqualified_reason + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason" useGeneratedKeys="true"> + insert into plt_product_unqualified_reason + ( id,pro_id,reason + ,deleted) + values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{reason,jdbcType=VARCHAR} + ,#{deleted,jdbcType=TINYINT}) + </insert> + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason" useGeneratedKeys="true"> + insert into plt_product_unqualified_reason + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="proId != null">pro_id,</if> + <if test="reason != null">reason,</if> + <if test="deleted != null">deleted,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null">#{id,jdbcType=BIGINT},</if> + <if test="proId != null">#{proId,jdbcType=BIGINT},</if> + <if test="reason != null">#{reason,jdbcType=VARCHAR},</if> + <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason"> + update plt_product_unqualified_reason + <set> + <if test="proId != null"> + pro_id = #{proId,jdbcType=BIGINT}, + </if> + <if test="reason != null"> + reason = #{reason,jdbcType=VARCHAR}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason"> + update plt_product_unqualified_reason + set + pro_id = #{proId,jdbcType=BIGINT}, + reason = #{reason,jdbcType=VARCHAR}, + deleted = #{deleted,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <select id="selectSome" resultMap="BaseResultMap"> + select + <include refid="part_Column_List" > + <property name="alias" value="t"/> + </include> + from plt_product_unqualified_reason t + inner join plt_product p on t.pro_id = p.id + where t.deleted!=1 + <trim prefix="and" suffixOverrides="and"> + <if test="proName != null and proName != ''"> + p.name like concat('%', #{proName}, '%') and + </if> + <if test="reason != null and reason != ''"> + t.reason like concat('%', #{reason}, '%') and + </if> + </trim> + order by id desc + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start}, #{count} + </if> + </trim> + </select> + + <select id="selectSomeCount" resultType="java.lang.Long"> + select count(1) + from plt_product_unqualified_reason t + inner join plt_product p on t.pro_id = p.id + where t.deleted!=1 + <trim prefix="and" suffixOverrides="and"> + <if test="proName != null and proName != ''"> + p.name like concat('%', #{proName}, '%') and + </if> + <if test="reason != null and reason != ''"> + t.reason like concat('%', #{reason}, '%') and + </if> + </trim> + </select> + + <update id="deleteLogicById" parameterType="java.lang.Long"> + update plt_product_unqualified_reason set deleted = 1 + where id = #{id} + </update> +</mapper> diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java new file mode 100644 index 0000000..df860b6 --- /dev/null +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java @@ -0,0 +1,132 @@ +package com.dy.pmsPlatform.proSR; + +import com.alibaba.fastjson2.JSON; +import com.dy.common.aop.SsoPowerAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pmsGlobal.aop.Log; +import com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason; +import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; + +/** + * 浜у搧璁惧鎶ュ簾鍘熷洜 + */ +@Slf4j +@RestController +@RequestMapping(path="proSR") +@SuppressWarnings("unchecked") +public class ProSRCtrl { + private ProSRSv sv; + @Autowired + public ProSRCtrl(ProSRSv sv){ + this.sv = sv; + } + + /** + * 淇濆瓨 + * @param reason + * @param bindingResult + * @return + */ + @PostMapping(path="save") + @SsoPowerAop(power = "10300001") + @Log("淇濆瓨浜у搧璁惧鎶ュ簾鍘熷洜") + public BaseResponse<PltProductScrappingReason> save(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ + try { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + reason.deleted = false; + return BaseResponseUtils.buildSuccess(sv.save(reason)); + }catch (Exception e){ + log.error("淇濆瓨浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 鏇存柊 + * @param reason + * @param bindingResult + * @return + */ + @PostMapping(path="update") + @SsoPowerAop(power = "10300001") + @Log("鏇存柊浜у搧璁惧鎶ュ簾鍘熷洜") + public BaseResponse<PltProductScrappingReason> update(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ + try { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + return BaseResponseUtils.buildSuccess(sv.update(reason)); + }catch (Exception e){ + log.error("鏇存柊浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** + * 鍒犻櫎 + * @param id + * @return + */ + @GetMapping(path="delete") + @SsoPowerAop(power = "10300001") + @Log("鍒犻櫎浜у搧璁惧鎶ュ簾鍘熷洜") + public BaseResponse<PltProductScrappingReason> delete(String id){ + try { + return BaseResponseUtils.buildSuccess(sv.delete(Long.parseLong(id))); + }catch (Exception e){ + log.error("鍒犻櫎浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + + /** + * 鏍规嵁ID鏌ヨ + * @return + */ + @GetMapping(path="one") + @SsoPowerAop(power = "10300000") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� + @Log("鏍规嵁ID鏌ヨ浜у搧璁惧鎶ュ簾鍘熷洜") + public BaseResponse<PltProductScrappingReason> one(String id){ + try{ + PltProductScrappingReason param=sv.selectById(id); + return BaseResponseUtils.buildSuccess(JSON.toJSON(param)); + }catch (Exception e){ + log.error("鏌ヨ浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** + * 鍒嗛〉鏌ヨ + * @param vo + * @return + */ + @PostMapping(path="some") + @SsoPowerAop(power = "10300000") + @Log("鏌ヨ浜у搧璁惧鎶ュ簾鍘熷洜") + public BaseResponse<QueryResultVo<List<PltProductScrappingReason>>> some(@RequestBody QueryVo vo){ + try { + QueryResultVo<List<PltProductScrappingReason>> list = sv.selectSome(vo) ; + return BaseResponseUtils.buildSuccess(list); + }catch (Exception e){ + log.error("鏌ヨ浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + +} + diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRSv.java new file mode 100644 index 0000000..a034582 --- /dev/null +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRSv.java @@ -0,0 +1,74 @@ +package com.dy.pmsPlatform.proSR; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pmsGlobal.daoPlt.PltProductScrappingReasonMapper; +import com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +@Slf4j +@Service +public class ProSRSv { + + private PltProductScrappingReasonMapper dao; + + @Autowired + public void setDao(PltProductScrappingReasonMapper dao) { + this.dao = dao; + } + + @Transactional + public int save(PltProductScrappingReason reason) { + int count = dao.insert(reason); + return count; + } + + /** + * 閫昏緫鍒犻櫎瀹炰綋 + * @param id 瀹炰綋ID + * @return 褰卞搷璁板綍鏁伴噺 + */ + @Transactional + public int delete(Long id) { + return this.dao.deleteLogicById(id); + } + + + + @Transactional + public int update(PltProductScrappingReason reason) { + int count = dao.updateByPrimaryKeySelective(reason); + return count; + } + + + public PltProductScrappingReason selectById(String reasonId) { + return dao.selectByPrimaryKey(Long.valueOf(reasonId)); + } + + /** + * 鑾峰彇鍙傛暟鍒楄〃 + */ + public QueryResultVo<List<PltProductScrappingReason>> selectSome(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟 + Long itemTotal = this.dao.selectSomeCount(params); + + QueryResultVo<List<PltProductScrappingReason>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ; + //璁$畻鍒嗛〉绛変俊鎭� + rsVo.calculateAndSet(itemTotal, params); + + //鏌ヨ绗﹀悎鏉′欢鐨勮褰� + rsVo.obj = this.dao.selectSome(params) ; + return rsVo ; + } + +} + diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/QueryVo.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/QueryVo.java new file mode 100644 index 0000000..a75a19c --- /dev/null +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/QueryVo.java @@ -0,0 +1,18 @@ +package com.dy.pmsPlatform.proSR; + +import com.dy.common.webUtil.QueryConditionVo; +import lombok.*; + +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class QueryVo extends QueryConditionVo { + public String reason; + /** + * 浜у搧鍚嶇О + */ + public String proName; +} diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java new file mode 100644 index 0000000..57493fa --- /dev/null +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java @@ -0,0 +1,133 @@ +package com.dy.pmsPlatform.proUR; + +import com.alibaba.fastjson2.JSON; +import com.dy.common.aop.SsoPowerAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pmsGlobal.aop.Log; +import com.dy.pmsGlobal.pojoPlt.PltProductParams; +import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; +import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; + +/** + * 浜у搧鐢熶骇涓嶅悎鏍煎師鍥� + */ +@Slf4j +@RestController +@RequestMapping(path="proUR") +@SuppressWarnings("unchecked") +public class ProURCtrl { + private ProURSv sv; + @Autowired + public ProURCtrl(ProURSv sv){ + this.sv = sv; + } + + /** + * 淇濆瓨浜у搧鐢熶骇涓嶅悎鏍煎師鍥� + * @param reason + * @param bindingResult + * @return + */ + @PostMapping(path="save") + @SsoPowerAop(power = "10300001") + @Log("淇濆瓨浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") + public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ + try { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + reason.deleted = false; + return BaseResponseUtils.buildSuccess(sv.save(reason)); + }catch (Exception e){ + log.error("淇濆瓨浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 鏇存柊浜у搧鐢熶骇涓嶅悎鏍煎師鍥� + * @param reason + * @param bindingResult + * @return + */ + @PostMapping(path="update") + @SsoPowerAop(power = "10300001") + @Log("鏇存柊浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") + public BaseResponse<PltProductUnqualifiedReason> update(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ + try { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + return BaseResponseUtils.buildSuccess(sv.update(reason)); + }catch (Exception e){ + log.error("鏇存柊浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** + * 鍒犻櫎浜у搧鐢熶骇涓嶅悎鏍煎師鍥� + * @param id + * @return + */ + @GetMapping(path="delete") + @SsoPowerAop(power = "10300001") + @Log("鍒犻櫎浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") + public BaseResponse<PltProductUnqualifiedReason> delete(String id){ + try { + return BaseResponseUtils.buildSuccess(sv.delete(Long.parseLong(id))); + }catch (Exception e){ + log.error("鍒犻櫎浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + + /** + * 鏍规嵁ID鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥� + * @return + */ + @GetMapping(path="one") + @SsoPowerAop(power = "10300000") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� + @Log("鏍规嵁ID鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") + public BaseResponse<PltProductUnqualifiedReason> one(String id){ + try{ + PltProductUnqualifiedReason param=sv.selectById(id); + return BaseResponseUtils.buildSuccess(JSON.toJSON(param)); + }catch (Exception e){ + log.error("鏍规嵁ID鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** + * 鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥� + * @param vo + * @return + */ + @PostMapping(path="some") + @SsoPowerAop(power = "10300000") + @Log("鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") + public BaseResponse<QueryResultVo<List<PltProductUnqualifiedReason>>> some(@RequestBody QueryVo vo){ + try { + QueryResultVo<List<PltProductUnqualifiedReason>> list = sv.selectSome(vo) ; + return BaseResponseUtils.buildSuccess(list); + }catch (Exception e){ + log.error("鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + +} + diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURSv.java new file mode 100644 index 0000000..b522f12 --- /dev/null +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURSv.java @@ -0,0 +1,74 @@ +package com.dy.pmsPlatform.proUR; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pmsGlobal.daoPlt.PltProductUnqualifiedReasonMapper; +import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +@Slf4j +@Service +public class ProURSv { + + private PltProductUnqualifiedReasonMapper dao; + + @Autowired + public void setDao(PltProductUnqualifiedReasonMapper dao) { + this.dao = dao; + } + + @Transactional + public int save(PltProductUnqualifiedReason reason) { + int count = dao.insert(reason); + return count; + } + + /** + * 閫昏緫鍒犻櫎瀹炰綋 + * @param id 瀹炰綋ID + * @return 褰卞搷璁板綍鏁伴噺 + */ + @Transactional + public int delete(Long id) { + return this.dao.deleteLogicById(id); + } + + + + @Transactional + public int update(PltProductUnqualifiedReason param) { + int count = dao.updateByPrimaryKeySelective(param); + return count; + } + + + public PltProductUnqualifiedReason selectById(String paramId) { + return dao.selectByPrimaryKey(Long.valueOf(paramId)); + } + + /** + * 鑾峰彇鍙傛暟鍒楄〃 + */ + public QueryResultVo<List<PltProductUnqualifiedReason>> selectSome(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟 + Long itemTotal = this.dao.selectSomeCount(params); + + QueryResultVo<List<PltProductUnqualifiedReason>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ; + //璁$畻鍒嗛〉绛変俊鎭� + rsVo.calculateAndSet(itemTotal, params); + + //鏌ヨ绗﹀悎鏉′欢鐨勮褰� + rsVo.obj = this.dao.selectSome(params) ; + return rsVo ; + } + +} + diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/QueryVo.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/QueryVo.java new file mode 100644 index 0000000..8ded3c4 --- /dev/null +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/QueryVo.java @@ -0,0 +1,18 @@ +package com.dy.pmsPlatform.proUR; + +import com.dy.common.webUtil.QueryConditionVo; +import lombok.*; + +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class QueryVo extends QueryConditionVo { + public String reason; + /** + * 浜у搧鍚嶇О + */ + public String proName; +} -- Gitblit v1.8.0