From 971c239a1db9d08c25f583b4697a6d049c697f88 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期二, 18 六月 2024 18:27:29 +0800
Subject: [PATCH] add plt_product_test_items table and relate methods

---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductTestItems.java           |   65 ++++++++
 pms-parent/pms-global/src/main/resources/mapper/PltProductTestItemsMapper.xml                   |  131 ++++++++++++++++
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsSv.java   |   77 +++++++++
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/QueryVo.java          |   15 +
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsCtrl.java |  138 +++++++++++++++++
 5 files changed, 426 insertions(+), 0 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductTestItems.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductTestItems.java
new file mode 100644
index 0000000..99921cd
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductTestItems.java
@@ -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;
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductTestItemsMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductTestItemsMapper.xml
new file mode 100644
index 0000000..2bd29c9
--- /dev/null
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductTestItemsMapper.xml
@@ -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>
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsCtrl.java
new file mode 100644
index 0000000..1c86b6f
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsCtrl.java
@@ -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);
+        }
+    }
+}
+
+
+
+
+
+
+
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsSv.java
new file mode 100644
index 0000000..3efca47
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/ProTestItemsSv.java
@@ -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);
+    }
+}
\ No newline at end of file
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/QueryVo.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/QueryVo.java
new file mode 100644
index 0000000..f45032c
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proTestItems/QueryVo.java
@@ -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;
+}
\ No newline at end of file

--
Gitblit v1.8.0