New file |
| | |
| | | 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 针对表【plt_product_scrapping_reason(产品设备报废原因表)】的数据库操作Mapper |
| | | * @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); |
| | | |
| | | } |
New file |
| | |
| | | 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 针对表【plt_product_unqualified_reason(产品生产不合格原因表)】的数据库操作Mapper |
| | | * @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); |
| | | |
| | | } |
| | |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 产品品质检查项目表 |
| | |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class PltProductQualityInspectionItems implements Serializable { |
| | | public class PltProductQualityInspectionItems{ |
| | | /** |
| | | * |
| | | */ |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | <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--> |
| | |
| | | <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"> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | 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 ; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | 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 ; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | 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; |
| | | } |