liuxm
2024-05-07 80a6306e4b7f1fde0a173547f5930b48764de037
产品技术参数
6个文件已添加
1个文件已修改
490 ■■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proParam/ParamCtrl.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proParam/ParamSv.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proParam/QueryVo.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java
New file
@@ -0,0 +1,58 @@
package com.dy.pmsGlobal.daoPlt;
import com.dy.pmsGlobal.pojoPlt.PltProductParams;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface PltProParamsMapper {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Long id);
    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(PltProductParams record);
    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(PltProductParams record);
    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    PltProductParams selectByPrimaryKey(Long id);
    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(PltProductParams record);
    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(PltProductParams record);
    int deleteLogicById(Long id);
    Long selectSomeCount(Map<String, Object> params);
    List<PltProductParams> selectSome(Map<String, Object> params);
}
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
New file
@@ -0,0 +1,53 @@
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.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;
@TableName(value="plt_product_params", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class PltProductParams {
    /**
     * 主键
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(value = "id", type = IdType.INPUT)
    public Long id;
    /**
    * 产品实体编号
    */
    public Long proId;
    /**
    * 技术参数名称
    */
    @NotEmpty(message = "技术参数名称不能为空")
    public String paramName;
    /**
    * 技术参数值
    */
    @NotEmpty(message = "技术参数值不能为空")
    public String paramValue;
    /**
    * 安装手册网文
    */
    public Long installManual;
    /**
    * 用户手册网文
    */
    public Long userManual;
    public Boolean deleted;
}
pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml
@@ -117,10 +117,10 @@
    where id = #{id}
  </update>
  <delete id="deleteLogicById" parameterType="java.lang.Long">
  <update id="deleteLogicById" parameterType="java.lang.Long">
    update ba_role set deleted = 1
    where id = #{id}
  </delete>
  </update>
  <select id="selectSomeCount" resultType="java.lang.Long">
    select
pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml
New file
@@ -0,0 +1,155 @@
<?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.PltProParamsMapper">
  <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductParams">
    <!--@mbg.generated-->
    <!--@Table plt_product_params-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="pro_id" jdbcType="BIGINT" property="proId" />
    <result column="param_name" jdbcType="VARCHAR" property="paramName" />
    <result column="param_value" jdbcType="VARCHAR" property="paramValue" />
    <result column="install_manual" jdbcType="BIGINT" property="installManual" />
    <result column="user_manual" jdbcType="BIGINT" property="userManual" />
    <result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, pro_id, param_name, param_value, install_manual, user_manual,deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from plt_product_params
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from plt_product_params
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductParams">
    <!--@mbg.generated-->
    insert into plt_product_params (id, pro_id, param_name,
      param_value, install_manual, user_manual,deleted
      )
    values (#{id,jdbcType=BIGINT}, #{proId,jdbcType=BIGINT}, #{paramName,jdbcType=VARCHAR},
      #{paramValue,jdbcType=VARCHAR}, #{installManual,jdbcType=BIGINT}, #{userManual,jdbcType=BIGINT},#{deleted,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductParams">
    <!--@mbg.generated-->
    insert into plt_product_params
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="paramName != null">
        param_name,
      </if>
      <if test="paramValue != null">
        param_value,
      </if>
      <if test="installManual != null">
        install_manual,
      </if>
      <if test="userManual != null">
        user_manual,
      </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="paramName != null">
        #{paramName,jdbcType=VARCHAR},
      </if>
      <if test="paramValue != null">
        #{paramValue,jdbcType=VARCHAR},
      </if>
      <if test="installManual != null">
        #{installManual,jdbcType=BIGINT},
      </if>
      <if test="userManual != null">
        #{userManual,jdbcType=BIGINT},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT}
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductParams">
    <!--@mbg.generated-->
    update plt_product_params
    <set>
      <if test="proId != null">
        pro_id = #{proId,jdbcType=BIGINT},
      </if>
      <if test="paramName != null">
        param_name = #{paramName,jdbcType=VARCHAR},
      </if>
      <if test="paramValue != null">
        param_value = #{paramValue,jdbcType=VARCHAR},
      </if>
      <if test="installManual != null">
        install_manual = #{installManual,jdbcType=BIGINT},
      </if>
      <if test="userManual != null">
        user_manual = #{userManual,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductParams">
    <!--@mbg.generated-->
    update plt_product_params
    set pro_id = #{proId,jdbcType=BIGINT},
      param_name = #{paramName,jdbcType=VARCHAR},
      param_value = #{paramValue,jdbcType=VARCHAR},
      install_manual = #{installManual,jdbcType=BIGINT},
      user_manual = #{userManual,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteLogicById">
    update plt_product_params set deleted = 1 where id = #{id}
  </delete>
  <select id="selectSome" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from plt_product_params p
    where p.deleted!=1
    <trim prefix="and " suffixOverrides="and">
      <if test="paramName != null and paramName != ''">
        p.param_name like concat('%', #{paramName}, '%') 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_params p
    where p.deleted!=1
    <trim prefix="and " suffixOverrides="and">
      <if test="paramName != null and paramName != ''">
        p.param_name like concat('%', #{paramName}, '%') and
      </if>
    </trim>
  </select>
</mapper>
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proParam/ParamCtrl.java
New file
@@ -0,0 +1,132 @@
package com.dy.pmsPlatform.proParam;
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 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="param")
@SuppressWarnings("unchecked")
public class ParamCtrl {
    private ParamSv sv;
    @Autowired
    public ParamCtrl(ParamSv sv){
        this.sv = sv;
    }
    /**
     * 保存产品技术参数信息
     * @param param
     * @param bindingResult
     * @return
     */
    @PostMapping(path="save")
    @SsoPowerAop(power = "10100011")
    @Log("保存产品技术参数信息")
    public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductParams param,BindingResult bindingResult){
        try {
            if (bindingResult != null && bindingResult.hasErrors()) {
                return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            }
            param.deleted = false;
            return BaseResponseUtils.buildSuccess(sv.save(param));
        }catch (Exception e){
            log.error("保存产品技术参数异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 更新产品技术参数信息
     * @param param
     * @param bindingResult
     * @return
     */
    @PostMapping(path="update")
    @SsoPowerAop(power = "10100011")
    @Log("更新产品技术参数信息")
    public BaseResponse<PltProductParams> update(@RequestBody @Valid PltProductParams param,BindingResult bindingResult){
        try {
            if (bindingResult != null && bindingResult.hasErrors()) {
                return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            }
            return BaseResponseUtils.buildSuccess(sv.update(param));
        }catch (Exception e){
            log.error("更新产品技术参数异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 删除产品技术参数信息
     * @param id
     * @return
     */
    @GetMapping(path="delete")
    @SsoPowerAop(power = "10100011")
    @Log("删除产品技术参数信息")
    public BaseResponse<PltProductParams> 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 = "10100010") //登录与权限同时验证
    @Log("根据ID查询产品技术参数信息")
    public BaseResponse<PltProductParams> one(String id){
        try{
            PltProductParams 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 = "10100010")
    @Log("查询产品技术参数信息")
    public BaseResponse<QueryResultVo<List<PltProductParams>>> some(@RequestBody QueryVo vo){
        try {
            QueryResultVo<List<PltProductParams>> 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/proParam/ParamSv.java
New file
@@ -0,0 +1,74 @@
package com.dy.pmsPlatform.proParam;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.daoPlt.PltProParamsMapper;
import com.dy.pmsGlobal.pojoPlt.PltProductParams;
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 ParamSv {
    private PltProParamsMapper dao;
    @Autowired
    public void setDao(PltProParamsMapper dao) {
        this.dao = dao;
    }
    @Transactional
    public int save(PltProductParams param) {
        int count = dao.insert(param);
        return count;
    }
    /**
     * 逻辑删除实体
     * @param id 实体ID
     * @return 影响记录数量
     */
    @Transactional
    public int delete(Long id) {
        return this.dao.deleteLogicById(id);
    }
    @Transactional
    public int update(PltProductParams param) {
        int count = dao.updateByPrimaryKeySelective(param);
        return count;
    }
    public PltProductParams selectById(String paramId) {
        return dao.selectByPrimaryKey(Long.valueOf(paramId));
    }
    /**
     * 获取参数列表
     */
    public QueryResultVo<List<PltProductParams>> selectSome(QueryVo queryVo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        //查询符合条件的记录总数
        Long itemTotal = this.dao.selectSomeCount(params);
        QueryResultVo<List<PltProductParams>> 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/proParam/QueryVo.java
New file
@@ -0,0 +1,14 @@
package com.dy.pmsPlatform.proParam;
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 paramName;
}