pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductTestItems.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pms-parent/pms-global/src/main/resources/mapper/PltProductTestItemsMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsCtrl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsSv.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/QueryVo.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductTestItems.java
New file @@ -0,0 +1,65 @@ package com.dy.pmsGlobal.pojoPlt; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; 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 java.io.Serializable; import com.dy.common.po.BaseEntity; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import lombok.*; /** * 产品测试检查项目表 * @TableName plt_product_test_items */ @TableName(value ="plt_product_test_items" , autoResultMap = true) @Data @Builder @ToString @NoArgsConstructor @AllArgsConstructor public class PltProductTestItems implements BaseEntity { /** * */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @TableId(type = IdType.AUTO) private Long id; /** * 产品实体编号 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @NotNull(message = "产品实体编号不能为空") private Long proId; /** * 测试项目 */ @NotEmpty(message = "测试项目不能为空") private String item; /** * 是否删除,1是,0否 */ private Boolean deleted; /** * 是否禁用,1是,0否 */ @JSONField(serialize = false) private Boolean disabled; /** * 排序 */ private Integer sort; } pms-parent/pms-global/src/main/resources/mapper/PltProductTestItemsMapper.xml
New file @@ -0,0 +1,131 @@ <?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.PltProductTestItemsMapper"> <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductTestItems"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="proId" column="pro_id" jdbcType="BIGINT"/> <result property="item" column="item" jdbcType="VARCHAR"/> <result property="deleted" column="deleted" jdbcType="TINYINT"/> <result property="disabled" column="disabled" jdbcType="TINYINT"/> <result property="sort" column="sort" jdbcType="INTEGER"/> </resultMap> <sql id="Base_Column_List"> id,pro_id,item, deleted,disabled,sort </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from plt_product_test_items where id = #{id,jdbcType=BIGINT} </select> <select id="selectSomeCount" resultType="java.lang.Long"> select count(1) from plt_product_test_items t where t.deleted!=1 <trim prefix="and" suffixOverrides="and"> <if test="proId != null and proId != ''"> t.pro_id=#{proId} and </if> <if test="item != null and item != ''"> t.item like concat('%', #{item}, '%') and </if> </trim> </select> <select id="selectSome" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from plt_product_test_items t where t.deleted!=1 <trim prefix="and" suffixOverrides="and"> <if test="proId != null and proId != ''"> t.pro_id=#{proId} and </if> <if test="item != null and item != ''"> t.item like concat('%', #{item}, '%') and </if> </trim> order by sort desc <trim prefix="limit " > <if test="start != null and count != null"> #{start}, #{count} </if> </trim> </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from plt_product_test_items where id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductTestItems" useGeneratedKeys="true"> insert into plt_product_test_items ( id,pro_id,item ,deleted,disabled,sort ) values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{item,jdbcType=VARCHAR} ,#{deleted,jdbcType=TINYINT},#{disabled,jdbcType=TINYINT},#{sort,jdbcType=INTEGER} ) </insert> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductTestItems" useGeneratedKeys="true"> insert into plt_product_test_items <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="proId != null">pro_id,</if> <if test="item != null">item,</if> <if test="deleted != null">deleted,</if> <if test="disabled != null">disabled,</if> <if test="sort != null">sort,</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="item != null">#{item,jdbcType=VARCHAR},</if> <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if> <if test="disabled != null">#{disabled,jdbcType=TINYINT},</if> <if test="sort != null">#{sort,jdbcType=INTEGER},</if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductTestItems"> update plt_product_test_items <set> <if test="proId != null"> pro_id = #{proId,jdbcType=BIGINT}, </if> <if test="item != null"> item = #{item,jdbcType=VARCHAR}, </if> <if test="deleted != null"> deleted = #{deleted,jdbcType=TINYINT}, </if> <if test="disabled != null"> disabled = #{disabled,jdbcType=TINYINT}, </if> <if test="sort != null"> sort = #{sort,jdbcType=INTEGER}, </if> </set> where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductTestItems"> update plt_product_test_items set pro_id = #{proId,jdbcType=BIGINT}, item = #{item,jdbcType=VARCHAR}, deleted = #{deleted,jdbcType=TINYINT}, disabled = #{disabled,jdbcType=TINYINT}, sort = #{sort,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT} </update> <update id="deleteLogicById" parameterType="java.lang.Long"> update plt_product_test_items set deleted = 1 where id = #{id} </update> </mapper> pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsCtrl.java
New file @@ -0,0 +1,138 @@ package com.dy.pmsPlatform.proTestItems; 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.PltProductTestItems; import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; import com.dy.pmsPlatform.proTestItems.ProTestItemsSv; import com.dy.pmsPlatform.proTestItems.QueryVo; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 产品测试检查项目 */ @Slf4j @RestController @RequestMapping(path="items") @SuppressWarnings("unchecked") public class ProTestItemsCtrl { private ProTestItemsSv sv; @Autowired public ProTestItemsCtrl(ProTestItemsSv sv){ this.sv = sv; } /** * 保存产品品质检查项目 * @param item * @return */ @PostMapping(path="save") @SsoPowerAop(power = "10300003") @Log("保存产品品质检查项目信息") public BaseResponse<Boolean> save(@RequestBody @Valid PltProductTestItems item){ item.deleted = false; item.disabled = false; int count =sv.save(item); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } else { return BaseResponseUtils.buildSuccess(true); } } /** * 更新产品品质检查项目信息 * @param item * @return */ @PostMapping(path="update") @SsoPowerAop(power = "10300003") @Log("更新产品品质检查项目信息") public BaseResponse<Boolean> update(@RequestBody @Valid PltProductTestItems item){ int count = sv.update(item); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } else { return BaseResponseUtils.buildSuccess(true); } } /** * 删除产品品质检查项目信息 * @param id * @return */ @GetMapping(path="delete") @SsoPowerAop(power = "10300003") @Log("删除产品品质检查项目信息") public BaseResponse<Boolean> delete(String id){ int count = sv.delete(Long.parseLong(id)); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } else { return BaseResponseUtils.buildSuccess(true); } } /** * 根据ID查询产品品质检查项目信息 * @return */ @GetMapping(path="one") @SsoPowerAop(power = "10300002") //登录与权限同时验证 @Log("根据ID查询产品品质检查项目信息") public BaseResponse<PltProductTestItems> one(String id){ PltProductTestItems item=sv.selectById(id); return BaseResponseUtils.buildSuccess(JSON.toJSON(item)); } /** * 查询产品品质检查项目信息 * @param vo * @return */ @PostMapping(path="some") @SsoPowerAop(power = "10300002") @Log("查询产品品质检查项目信息") public BaseResponse<QueryResultVo<List<PltProductTestItems>>> some(@RequestBody QueryVo vo){ QueryResultVo<List<PltProductTestItems>> list = sv.selectSome(vo) ; return BaseResponseUtils.buildSuccess(list); } /** * 禁用或启用 * @param reason * @return */ @PostMapping(path="disabled") @SsoPowerAop(power = "10100011") @Log("禁用或启用质检项目") public BaseResponse<Boolean> disabled(@RequestBody PltProductUnqualifiedReason reason){ int count = sv.disabled(reason.id,reason.disabled); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } else { return BaseResponseUtils.buildSuccess(true); } } } pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsSv.java
New file @@ -0,0 +1,77 @@ package com.dy.pmsPlatform.proTestItems; import com.dy.common.webUtil.QueryResultVo; import com.dy.pmsGlobal.daoPlt.PltProductTestItemsMapper; import com.dy.pmsGlobal.pojoPlt.PltProductTestItems; import com.dy.pmsPlatform.proTestItems.QueryVo; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @Slf4j @Service public class ProTestItemsSv { private final PltProductTestItemsMapper dao; public ProTestItemsSv(PltProductTestItemsMapper dao) { this.dao = dao; } @Transactional public int save(PltProductTestItems item) { int count = dao.insertSelective(item); return count; } /** * 逻辑删除实体 * @param id 实体ID * @return 影响记录数量 */ @Transactional public int delete(Long id) { return this.dao.deleteLogicById(id); } @Transactional public int update(PltProductTestItems item) { int count = dao.updateByPrimaryKeySelective(item); return count; } public PltProductTestItems selectById(String paramId) { return dao.selectByPrimaryKey(Long.valueOf(paramId)); } /** * 获取列表 */ public QueryResultVo<List<PltProductTestItems>> selectSome(QueryVo queryVo) { Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); //查询符合条件的记录总数 Long itemTotal = this.dao.selectSomeCount(params); QueryResultVo<List<PltProductTestItems>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ; //计算分页等信息 rsVo.calculateAndSet(itemTotal, params); //查询符合条件的记录 rsVo.obj = this.dao.selectSome(params) ; return rsVo ; } @Transactional public int disabled(Long id, Boolean disabled) { PltProductTestItems item = new PltProductTestItems(); item.setId(id); item.setDisabled(disabled); return dao.updateByPrimaryKeySelective(item); } } pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/QueryVo.java
New file @@ -0,0 +1,15 @@ package com.dy.pmsPlatform.proTestItems; 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 item; public Long proId; }