From 817734d6a36e8595dbbb0080cbcbfda0c51bafae Mon Sep 17 00:00:00 2001
From: liuxm <liuxm@fescotech.com>
Date: 星期三, 08 五月 2024 17:48:21 +0800
Subject: [PATCH] 产品品质检查项目
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductQualityInspectionItemsMapper.java | 36 ++++
pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml | 129 ++++++++++++++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java | 1
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java | 133 ++++++++++++++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java | 1
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java | 52 ++++++
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsSv.java | 69 ++++++++
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/QueryVo.java | 15 +
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 6
9 files changed, 441 insertions(+), 1 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductQualityInspectionItemsMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductQualityInspectionItemsMapper.java
new file mode 100644
index 0000000..443b9ab
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductQualityInspectionItemsMapper.java
@@ -0,0 +1,36 @@
+package com.dy.pmsGlobal.daoPlt;
+
+import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author 灏忔槑
+* @description 閽堝琛ㄣ�恜lt_product_quality_inspection_items(浜у搧鍝佽川妫�鏌ラ」鐩〃)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-05-07 13:46:45
+* @Entity com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems
+*/
+@Mapper
+public interface PltProductQualityInspectionItemsMapper {
+
+ int deleteByPrimaryKey(Long id);
+
+ int insert(PltProductQualityInspectionItems record);
+
+ int insertSelective(PltProductQualityInspectionItems record);
+
+ PltProductQualityInspectionItems selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(PltProductQualityInspectionItems record);
+
+ int updateByPrimaryKey(PltProductQualityInspectionItems record);
+
+ Long selectSomeCount(Map<String,Object> params);
+
+ List<PltProductQualityInspectionItems> selectSome(Map<String,Object> params);
+
+ int deleteLogicById(Long id);
+
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
index a170981..296f51e 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
@@ -60,6 +60,7 @@
*/
public String dMobile;
+ @JSONField(serialize = false)
public Boolean deleted;
/**
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
index c5306cf..b9d29f8 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
@@ -49,5 +49,6 @@
*/
public Long userManual;
+ @JSONField(serialize = false)
public Boolean deleted;
}
\ No newline at end of file
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
new file mode 100644
index 0000000..33a1992
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java
@@ -0,0 +1,52 @@
+package com.dy.pmsGlobal.pojoPlt;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+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.*;
+
+import java.io.Serializable;
+
+/**
+ * 浜у搧鍝佽川妫�鏌ラ」鐩〃
+ * @TableName plt_product_quality_inspection_items
+ */
+@TableName(value="plt_product_quality_inspection_items", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class PltProductQualityInspectionItems implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ public Long id;
+
+ /**
+ * 浜у搧瀹炰綋缂栧彿
+ */
+ @NotNull(message = "浜у搧瀹炰綋缂栧彿涓嶈兘涓虹┖")
+ public Long proId;
+
+ @TableField(exist = false)
+ public String proName;
+
+ /**
+ * 鍝佹椤圭洰
+ */
+ @NotEmpty(message = "鍝佹椤圭洰涓嶈兘涓虹┖")
+ public String item;
+
+ /**
+ * 鏄惁鍒犻櫎锛�1鏄紝0鍚�
+ */
+ @JSONField(serialize = false)
+ 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 00d97f0..0cca318 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="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNameById" />
+ select="selectNameById" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
@@ -28,6 +28,10 @@
from plt_product
where id = #{id,jdbcType=BIGINT}
</select>
+ <select id="selectNameById" parameterType="java.lang.Long" resultType="java.lang.String">
+ select name directorName from ba_user where id=#{id}
+ </select>
+
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from plt_product
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml
new file mode 100644
index 0000000..49dde20
--- /dev/null
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.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.PltProductQualityInspectionItemsMapper">
+
+ <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems">
+ <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"/>
+ <association property="proName" column="pro_id" javaType="java.lang.Long"
+ select="selectProNameById" />
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ id,pro_id,item,
+ deleted
+ </sql>
+ <sql id="part_Column_List">
+ ${alias}.id,
+ ${alias}.pro_id,
+ ${alias}.item,
+ ${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_quality_inspection_items
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ delete from plt_product_quality_inspection_items
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems" useGeneratedKeys="true">
+ insert into plt_product_quality_inspection_items
+ ( id,pro_id,item
+ ,deleted)
+ values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{item,jdbcType=VARCHAR}
+ ,#{deleted,jdbcType=TINYINT})
+ </insert>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems" useGeneratedKeys="true">
+ insert into plt_product_quality_inspection_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>
+ </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>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems">
+ update plt_product_quality_inspection_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>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems">
+ update plt_product_quality_inspection_items
+ set
+ pro_id = #{proId,jdbcType=BIGINT},
+ item = #{item,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_quality_inspection_items 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="item != null and item != ''">
+ t.item like concat('%', #{item}, '%') 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_quality_inspection_items 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="item != null and item != ''">
+ t.item like concat('%', #{item}, '%') and
+ </if>
+ </trim>
+ </select>
+
+ <update id="deleteLogicById" parameterType="java.lang.Long">
+ update plt_product_quality_inspection_items set deleted = 1
+ where id = #{id}
+ </update>
+</mapper>
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java
new file mode 100644
index 0000000..ef11a70
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java
@@ -0,0 +1,133 @@
+package com.dy.pmsPlatform.proItems;
+
+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.PltProductQualityInspectionItems;
+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="items")
+@SuppressWarnings("unchecked")
+public class ProItemsCtrl {
+ private ProItemsSv sv;
+ @Autowired
+ public ProItemsCtrl(ProItemsSv sv){
+ this.sv = sv;
+ }
+
+ /**
+ * 淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩�
+ * @param item
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path="save")
+ @SsoPowerAop(power = "10300001")
+ @Log("淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
+ public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductQualityInspectionItems item, BindingResult bindingResult){
+ try {
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ item.deleted = false;
+ return BaseResponseUtils.buildSuccess(sv.save(item));
+ }catch (Exception e){
+ log.error("淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+
+ /**
+ * 鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�
+ * @param item
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path="update")
+ @SsoPowerAop(power = "10300001")
+ @Log("鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
+ public BaseResponse<PltProductParams> update(@RequestBody @Valid PltProductQualityInspectionItems item,BindingResult bindingResult){
+ try {
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ return BaseResponseUtils.buildSuccess(sv.update(item));
+ }catch (Exception e){
+ log.error("鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+ /**
+ * 鍒犻櫎浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�
+ * @param id
+ * @return
+ */
+ @GetMapping(path="delete")
+ @SsoPowerAop(power = "10300001")
+ @Log("鍒犻櫎浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
+ public BaseResponse<PltProductQualityInspectionItems> 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<PltProductQualityInspectionItems> one(String id){
+ try{
+ PltProductQualityInspectionItems item=sv.selectById(id);
+ return BaseResponseUtils.buildSuccess(JSON.toJSON(item));
+ }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<PltProductQualityInspectionItems>>> some(@RequestBody QueryVo vo){
+ try {
+ QueryResultVo<List<PltProductQualityInspectionItems>> 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/proItems/ProItemsSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsSv.java
new file mode 100644
index 0000000..58edb31
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsSv.java
@@ -0,0 +1,69 @@
+package com.dy.pmsPlatform.proItems;
+
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.daoPlt.PltProductQualityInspectionItemsMapper;
+import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems;
+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 ProItemsSv {
+ private final PltProductQualityInspectionItemsMapper dao;
+
+ public ProItemsSv(PltProductQualityInspectionItemsMapper dao) {
+ this.dao = dao;
+ }
+
+ @Transactional
+ public int save(PltProductQualityInspectionItems item) {
+ int count = dao.insert(item);
+ return count;
+ }
+
+ /**
+ * 閫昏緫鍒犻櫎瀹炰綋
+ * @param id 瀹炰綋ID
+ * @return 褰卞搷璁板綍鏁伴噺
+ */
+ @Transactional
+ public int delete(Long id) {
+ return this.dao.deleteLogicById(id);
+ }
+
+
+
+ @Transactional
+ public int update(PltProductQualityInspectionItems item) {
+ int count = dao.updateByPrimaryKeySelective(item);
+ return count;
+ }
+
+
+ public PltProductQualityInspectionItems selectById(String paramId) {
+ return dao.selectByPrimaryKey(Long.valueOf(paramId));
+ }
+
+ /**
+ * 鑾峰彇鍒楄〃
+ */
+ public QueryResultVo<List<PltProductQualityInspectionItems>> selectSome(QueryVo queryVo) {
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+ //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟
+ Long itemTotal = this.dao.selectSomeCount(params);
+
+ QueryResultVo<List<PltProductQualityInspectionItems>> 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/proItems/QueryVo.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/QueryVo.java
new file mode 100644
index 0000000..68b6bb9
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/QueryVo.java
@@ -0,0 +1,15 @@
+package com.dy.pmsPlatform.proItems;
+
+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 String proName;
+}
--
Gitblit v1.8.0