liuxm
2024-05-08 817734d6a36e8595dbbb0080cbcbfda0c51bafae
产品品质检查项目
3个文件已修改
6个文件已添加
442 ■■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductQualityInspectionItemsMapper.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsSv.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/QueryVo.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductQualityInspectionItemsMapper.java
New file
@@ -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 针对表【plt_product_quality_inspection_items(产品品质检查项目表)】的数据库操作Mapper
* @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);
}
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;
    /**
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;
}
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java
New file
@@ -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;
}
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
pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml
New file
@@ -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>
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java
New file
@@ -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());
        }
    }
}
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsSv.java
New file
@@ -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 ;
    }
}
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/QueryVo.java
New file
@@ -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;
}