From b8646a66b432920ba9c6b21964d0f132973b7dfc Mon Sep 17 00:00:00 2001
From: liuxm <liuxm@fescotech.com>
Date: 星期一, 29 四月 2024 11:29:44 +0800
Subject: [PATCH] 产品管理相关
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java | 28 ++
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java | 126 +++++++++
pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml | 12
pms-parent/pms-global/src/main/resources/mapper/OthFileMapper.xml | 13 +
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java | 5
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/QueryVo.java | 3
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java | 34 ++
pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml | 72 +++++
pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml | 4
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java | 76 +++++
pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml | 4
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoOth/OthFileMapper.java | 4
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java | 152 +++++++++++
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/QueryVo.java | 17 +
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java | 19 +
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 200 +++++++++++++++
16 files changed, 760 insertions(+), 9 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java
index 71605a8..636e66c 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java
@@ -34,6 +34,8 @@
public String SsoCurUserUrl ;
private LogService logSv;
+ @Value("${pms.global.dev}")
+ public String isDevStage ;//鏄惁涓哄紑鍙戦樁娈�
@Autowired
public void setLogSv(LogService logSv){
this.logSv = logSv;
@@ -46,6 +48,9 @@
@AfterReturning(pointcut = "@annotation(com.dy.pmsGlobal.aop.Log)", returning = "result")
public void logAfterReturning(JoinPoint joinPoint, BaseResponse result) {
+ if(isDevStage != null && !isDevStage.trim().equals("") && isDevStage.trim().equalsIgnoreCase("true")){
+ return;
+ }
try{
// 鑾峰彇鐢ㄦ埛淇℃伅
BaUser user = (BaUser)getCurUser(result);
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoOth/OthFileMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoOth/OthFileMapper.java
index 156d80d..69aaa0b 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoOth/OthFileMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoOth/OthFileMapper.java
@@ -3,6 +3,8 @@
import com.dy.pmsGlobal.pojoOth.OthFile;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
@Mapper
public interface OthFileMapper {
int deleteByPrimaryKey(Long id);
@@ -16,4 +18,6 @@
int updateByPrimaryKeySelective(OthFile record);
int updateByPrimaryKey(OthFile record);
+
+ List<OthFile> selectByProId(long proId);
}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
new file mode 100644
index 0000000..4ab9b22
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
@@ -0,0 +1,19 @@
+package com.dy.pmsGlobal.daoPlt;
+
+import com.dy.pmsGlobal.pojoPlt.PltProductFile;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PltProductFileMapper {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(PltProductFile record);
+
+ int insertSelective(PltProductFile record);
+
+ PltProductFile selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(PltProductFile record);
+
+ int updateByPrimaryKey(PltProductFile record);
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
new file mode 100644
index 0000000..955d898
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
@@ -0,0 +1,28 @@
+package com.dy.pmsGlobal.daoPlt;
+
+import com.dy.pmsGlobal.pojoPlt.PltProduct;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface PltProductMapper {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(PltProduct record);
+
+ int insertSelective(PltProduct record);
+
+ PltProduct selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(PltProduct record);
+
+ int updateByPrimaryKey(PltProduct record);
+
+ Long selectSomeCount(Map<String, Object> params);
+
+ List<PltProduct> selectSome(Map<String, Object> params);
+
+ int deleteLogicById(Long id);
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..a170981
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
@@ -0,0 +1,76 @@
+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 jakarta.validation.constraints.NotEmpty;
+import lombok.*;
+
+import java.util.Date;
+
+@TableName(value="plt_product", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class PltProduct {
+ /**
+ * 涓婚敭
+ */
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ @TableId(value = "id", type = IdType.INPUT)
+ public Long id;
+
+ /**
+ * 鍚嶇О
+ */
+ @NotEmpty(message = "鍚嶇О涓嶈兘涓虹┖")
+ public String name;
+
+ /**
+ * 鍨嬪彿
+ */
+ public String type;
+
+ /**
+ * 鍏稿瀷鍥剧墖
+ */
+ public Long image;
+
+ @TableField(exist = false)
+ public String imageWebPath;
+
+ @TableField(exist = false)
+ public String imageWebPathZip;
+
+ /**
+ * 鎶�鏈礋璐d汉
+ */
+ public Long director;
+
+ @TableField(exist = false)
+ public String directorName;
+
+ /**
+ * 鎶�鏈礋璐d汉鎵嬫満鍙�
+ */
+ public String dMobile;
+
+ public Boolean deleted;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ public Date dt;
+
+ /**
+ * 澶囨敞
+ */
+ public String remark;
+
+
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java
new file mode 100644
index 0000000..5a60fa6
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java
@@ -0,0 +1,34 @@
+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 lombok.*;
+
+/**
+ * 浜у搧鏂囦欢鍏宠仈琛�
+ */
+@TableName(value="plt_product_file", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class PltProductFile {
+ /**
+ * 涓婚敭
+ */
+ public Long id;
+
+ /**
+ * 浜у搧瀹炰綋缂栧彿
+ */
+ public Long proId;
+
+ /**
+ * 鏂囦欢缂栧彿
+ */
+ public Long fileId;
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml
index 5c0e8fb..7ec9208 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml
@@ -94,7 +94,7 @@
content like concat('%', #{content}, '%') and
</if>
<if test="dt != null and dt != '' ">
- dt = #{dt,jdbcType=TIMESTAMP} and
+ DATE_FORMAT(dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP} and
</if>
<if test="ip != null and ip != '' ">
ip =#{ip,jdbcType=VARCHAR} and
@@ -122,7 +122,7 @@
content like concat('%', #{content}, '%') and
</if>
<if test="dt != null and dt != '' ">
- dt = #{dt,jdbcType=TIMESTAMP} and
+ DATE_FORMAT(dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP} and
</if>
<if test="ip != null and ip != '' ">
ip =#{ip,jdbcType=VARCHAR} and
diff --git a/pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml
index f83630f..8404420 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/BaRoleMapper.xml
@@ -147,8 +147,8 @@
<if test="name != null and name != ''">
r.name like concat('%', #{name}, '%') and
</if>
- <if test="disable != null and disable != ''">
- r.disable =#{disabled,jdbcType=BOOLEAN} and
+ <if test="disabled != null and disabled != ''">
+ r.disabled =#{disabled,jdbcType=BOOLEAN} and
</if>
<if test="dt != null and dt != ''">
DATE_FORMAT(r.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP} and
diff --git a/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml
index 199414c..66b8221 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml
@@ -11,7 +11,7 @@
<result column="supper_admin" property="supperAdmin" />
<result column="disabled" property="disabled" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
<result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
- <result column="dt" property="dt" />
+ <result column="create_dt" property="dt" />
</resultMap>
<resultMap id="partResultMap" type="com.dy.pmsGlobal.pojoBa.BaUser">
<!--@mbg.generated-->
@@ -37,10 +37,10 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
- id, `name`, phone, `password`, supper_admin, disabled, deleted,dt
+ id, `name`, phone, `password`, supper_admin, disabled, deleted, create_dt
</sql>
<sql id="part_Column_List">
- ${alias}.id, ${alias}.name, ${alias}.phone, ${alias}.password, ${alias}.disabled,${alias}.dt
+ ${alias}.id, ${alias}.name, ${alias}.phone, ${alias}.password, ${alias}.disabled,${alias}.create_dt
</sql>
<sql id="Login_Column_List">
id, name, phone, supper_admin
@@ -79,7 +79,7 @@
bu.name like concat('%', #{name}, '%') and
</if>
<if test="phone != null and phone !=''">
- bu.phone = #{phone,jdbcType=VARCHAR}
+ bu.phone = #{phone,jdbcType=VARCHAR} and
</if>
<if test="roleId != null">
ur.role_id=#{roleId,jdbcType=BIGINT}
@@ -116,6 +116,10 @@
</trim>
</select>
+ <select id="selectNameById" parameterType="java.lang.Long" resultType="java.lang.String">
+ select name from ba_user where id=#{id}
+ </select>
+
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
diff --git a/pms-parent/pms-global/src/main/resources/mapper/OthFileMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/OthFileMapper.xml
index 1763752..9442d62 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/OthFileMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/OthFileMapper.xml
@@ -16,6 +16,9 @@
<!--@mbg.generated-->
id, org_name, ext_name, new_name, hash, file_path, dt
</sql>
+ <sql id="Join_Column_List">
+ ${alias}.id, ${alias}.org_name, ${alias}.ext_name, ${alias}.new_name, ${alias}.hash, ${alias}.file_path, ${alias}.dt
+ </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
@@ -121,4 +124,14 @@
dt = #{dt}
where id = #{id}
</update>
+
+ <select id="selectByProId" resultMap="BaseResultMap">
+ select
+ <include refid="Join_Column_List">
+ <property name="alias" value="f"/>
+ </include>
+ from oth_file f
+ inner join plt_product_file pf on f.id = pf.file_id
+ where pf.pro_id = #{proId}
+ </select>
</mapper>
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
new file mode 100644
index 0000000..ebdfbf9
--- /dev/null
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
@@ -0,0 +1,72 @@
+<?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.PltProductFileMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductFile">
+ <!--@mbg.generated-->
+ <!--@Table plt_product_file-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="pro_id" jdbcType="BIGINT" property="proId" />
+ <result column="file_id" jdbcType="BIGINT" property="fileId" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, pro_id, file_id
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from plt_product_file
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from plt_product_file
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into plt_product_file (pro_id, file_id)
+ values (#{proId,jdbcType=BIGINT}, #{fileId,jdbcType=BIGINT})
+ </insert>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into plt_product_file
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="proId != null">
+ pro_id,
+ </if>
+ <if test="fileId != null">
+ file_id,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="proId != null">
+ #{proId,jdbcType=BIGINT},
+ </if>
+ <if test="fileId != null">
+ #{fileId,jdbcType=BIGINT},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile">
+ <!--@mbg.generated-->
+ update plt_product_file
+ <set>
+ <if test="proId != null">
+ pro_id = #{proId,jdbcType=BIGINT},
+ </if>
+ <if test="fileId != null">
+ file_id = #{fileId,jdbcType=BIGINT},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile">
+ <!--@mbg.generated-->
+ update plt_product_file
+ set pro_id = #{proId,jdbcType=BIGINT},
+ file_id = #{fileId,jdbcType=BIGINT}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+</mapper>
\ 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
new file mode 100644
index 0000000..00d97f0
--- /dev/null
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -0,0 +1,200 @@
+<?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.PltProductMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProduct">
+ <!--@mbg.generated-->
+ <!--@Table plt_product-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="name" jdbcType="VARCHAR" property="name" />
+ <result column="type" jdbcType="VARCHAR" property="type" />
+ <result column="image" jdbcType="BIGINT" property="image" />
+ <result column="director" jdbcType="BIGINT" property="director" />
+ <result column="d_mobile" jdbcType="VARCHAR" property="dMobile" />
+ <result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
+ <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" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, `name`, `type`, image, director, d_mobile,deleted, dt, remark
+ </sql>
+
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from plt_product
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from plt_product
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProduct" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into plt_product (`name`, `type`, image,
+ director, d_mobile,deleted, dt,
+ remark)
+ values (#{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{image,jdbcType=BIGINT},
+ #{director,jdbcType=BIGINT}, #{dMobile,jdbcType=VARCHAR},#{deleted,jdbcType=TINYINT}, #{dt,jdbcType=TIMESTAMP},
+ #{remark,jdbcType=VARCHAR})
+ </insert>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProduct" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into plt_product
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="name != null">
+ `name`,
+ </if>
+ <if test="type != null">
+ `type`,
+ </if>
+ <if test="image != null">
+ image,
+ </if>
+ <if test="director != null">
+ director,
+ </if>
+ <if test="dMobile != null">
+ d_mobile,
+ </if>
+ <if test="dt != null">
+ dt,
+ </if>
+ <if test="remark != null">
+ remark,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="name != null">
+ #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="type != null">
+ #{type,jdbcType=VARCHAR},
+ </if>
+ <if test="image != null">
+ #{image,jdbcType=BIGINT},
+ </if>
+ <if test="director != null">
+ #{director,jdbcType=BIGINT},
+ </if>
+ <if test="dMobile != null">
+ #{dMobile,jdbcType=VARCHAR},
+ </if>
+ <if test="dt != null">
+ #{dt,jdbcType=TIMESTAMP},
+ </if>
+ <if test="remark != null">
+ #{remark,jdbcType=VARCHAR},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProduct">
+ <!--@mbg.generated-->
+ update plt_product
+ <set>
+ <if test="name != null">
+ `name` = #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="type != null">
+ `type` = #{type,jdbcType=VARCHAR},
+ </if>
+ <if test="image != null">
+ image = #{image,jdbcType=BIGINT},
+ </if>
+ <if test="director != null">
+ director = #{director,jdbcType=BIGINT},
+ </if>
+ <if test="dMobile != null">
+ d_mobile = #{dMobile,jdbcType=VARCHAR},
+ </if>
+ <if test="dt != null">
+ dt = #{dt,jdbcType=TIMESTAMP},
+ </if>
+ <if test="remark != null">
+ remark = #{remark,jdbcType=VARCHAR},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProduct">
+ <!--@mbg.generated-->
+ update plt_product
+ set `name` = #{name,jdbcType=VARCHAR},
+ `type` = #{type,jdbcType=VARCHAR},
+ image = #{image,jdbcType=BIGINT},
+ director = #{director,jdbcType=BIGINT},
+ d_mobile = #{dMobile,jdbcType=VARCHAR},
+ dt = #{dt,jdbcType=TIMESTAMP},
+ remark = #{remark,jdbcType=VARCHAR}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+ <update id="deleteLogicById" parameterType="java.lang.Long">
+ update plt_product set deleted = 1
+ where id = #{id}
+ </update>
+
+ <sql id="Join_Column_List">
+ ${alias}.id, ${alias}.`name`, ${alias}.`type`, ${alias}.image, ${alias}.director, ${alias}.d_mobile,${alias}.deleted, ${alias}.dt, ${alias}.remark
+ </sql>
+ <select id="selectSome" resultMap="BaseResultMap">
+ select
+ <include refid="Join_Column_List" >
+ <property name="alias" value="p"/>
+ </include>
+ from plt_product p
+ left join ba_user u on u.id=p.director
+ where p.deleted!=1 and u.deleted!=1
+ <trim prefix="and " suffixOverrides="and">
+ <if test="type != null and type != ''">
+ p.type = #{type,jdbcType=VARCHAR} and
+ </if>
+ <if test="name != null and name != ''">
+ p.name like concat('%', #{name}, '%') and
+ </if>
+ <if test="director != null and director != '' ">
+ u.name like concat('%', #{director}, '%') and
+ </if>
+ <if test="dMobile != null and dMobile != '' ">
+ p.d_mobile =#{dMobile,jdbcType=VARCHAR} and
+ </if>
+ <if test="dt != null and dt != '' ">
+ DATE_FORMAT(p.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP}
+ </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 p
+ left join ba_user u on u.id=p.director
+ where p.deleted!=1 and u.deleted!=1
+ <trim prefix="and " suffixOverrides="and">
+ <if test="type != null and type != ''">
+ p.type = #{type,jdbcType=VARCHAR} and
+ </if>
+ <if test="name != null and name != ''">
+ u.name like concat('%', #{name}, '%') and
+ </if>
+ <if test="director != null and director != '' ">
+ p.director like concat('%', #{director}, '%') and
+ </if>
+ <if test="dMobile != null and dMobile != '' ">
+ p.d_mobile =#{dMobile,jdbcType=VARCHAR} and
+ </if>
+ <if test="dt != null and dt != '' ">
+ DATE_FORMAT(p.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP}
+ </if>
+ </trim>
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/QueryVo.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/QueryVo.java
index 1a707e1..f47fe50 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/QueryVo.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/QueryVo.java
@@ -1,6 +1,7 @@
package com.dy.pmsBase.role;
import com.dy.common.webUtil.QueryConditionVo;
+import com.dy.pmsGlobal.pojoBa.BaRole;
import lombok.*;
@Data
@@ -11,6 +12,6 @@
@Builder
public class QueryVo extends QueryConditionVo {
public String name;
- public boolean disable;
+ public boolean disabled;
public String dt;
}
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
new file mode 100644
index 0000000..0f93791
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
@@ -0,0 +1,152 @@
+package com.dy.pmsPlatform.product;
+
+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.daoOth.OthFileMapper;
+import com.dy.pmsGlobal.dyFile.FileOperate;
+import com.dy.pmsGlobal.dyFile.FileRestVo;
+import com.dy.pmsGlobal.pojoOth.OthFile;
+import com.dy.pmsGlobal.pojoPlt.PltProduct;
+import jakarta.validation.Valid;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 浜у搧绠$悊
+ */
+@Slf4j
+@RestController
+@RequestMapping(path = "product")
+@SuppressWarnings("unchecked")
+public class ProductCtrl {
+
+
+ private ProductSv proSv;
+ @Autowired
+ public void setProSv(ProductSv proSv){
+ this.proSv = proSv;
+ }
+
+
+
+ /**
+ * 淇濆瓨浜у搧淇℃伅
+ * @param pro
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path="save")
+ @SsoPowerAop(power = "10100011")
+ @Log("淇濆瓨浜у搧淇℃伅")
+ public BaseResponse<PltProduct> save(@RequestBody @Valid PltProduct pro, BindingResult bindingResult){
+ pro.id = null;
+ Long id;
+ try {
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ pro.setDeleted(false);
+ id = proSv.save(pro);
+ }catch (Exception e){
+ log.error("淇濆瓨浜у搧寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ if (id <= 0) {
+ return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+ } else {
+ return BaseResponseUtils.buildSuccess(true);
+ }
+ }
+
+
+ /**
+ * 鏇存柊浜у搧淇℃伅
+ * @param pro
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path="update")
+ @SsoPowerAop(power = "10100011")
+ @Log("鏇存柊浜у搧淇℃伅")
+ public BaseResponse<PltProduct> update(@RequestBody @Valid PltProduct pro,BindingResult bindingResult){
+ int count;
+ try {
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ count = proSv.update(pro);
+ }catch (Exception e){
+ log.error("鏇存柊浜у搧寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ if (count <= 0) {
+ return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+ } else {
+ return BaseResponseUtils.buildSuccess(true);
+ }
+ }
+
+ /**
+ * 鍒犻櫎浜у搧淇℃伅
+ * @param id
+ * @return
+ */
+ @GetMapping(path="delete")
+ @SsoPowerAop(power = "10100011")
+ @Log("鍒犻櫎浜у搧淇℃伅")
+ public BaseResponse<PltProduct> delete(String id){
+ try {
+ return BaseResponseUtils.buildSuccess(proSv.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<PltProduct> one(String id){
+ try{
+ PltProduct pro=proSv.selectById(id);
+
+ return BaseResponseUtils.buildSuccess(JSON.toJSON(pro));
+ }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<PltProduct>>> some(@RequestBody QueryVo vo){
+ try {
+ QueryResultVo<List<PltProduct>> list = proSv.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/product/ProductSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
new file mode 100644
index 0000000..7ca53a1
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -0,0 +1,126 @@
+package com.dy.pmsPlatform.product;
+
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.daoOth.OthFileMapper;
+import com.dy.pmsGlobal.daoPlt.PltProductFileMapper;
+import com.dy.pmsGlobal.daoPlt.PltProductMapper;
+import com.dy.pmsGlobal.dyFile.FileOperate;
+import com.dy.pmsGlobal.dyFile.FileRestVo;
+import com.dy.pmsGlobal.pojoOth.OthFile;
+import com.dy.pmsGlobal.pojoPlt.PltProduct;
+import com.dy.pmsGlobal.pojoPlt.PltProductFile;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class ProductSv {
+ private PltProductMapper dao;
+ private PltProductFileMapper pfDao;
+
+ private FileOperate fileOperate;
+ private OthFileMapper othFileMapper;
+
+ @Value("${dy.webFile.fmUrl}")
+ private String fmUrl ;
+
+ @Autowired
+ public void setFileOperate(FileOperate fileOperate){
+ this.fileOperate = fileOperate;
+ }
+ @Autowired
+ public void setOthFileMapper(OthFileMapper othFileMapper){
+ this.othFileMapper = othFileMapper;
+ }
+
+ @Autowired
+ public void setDao(PltProductMapper dao) {
+ this.dao = dao;
+ }
+ @Autowired
+ public void setPfDao(PltProductFileMapper pfDao) {
+ this.pfDao = pfDao;
+ }
+
+ @Transactional
+ public long save(PltProduct p) {
+ return dao.insert(p);
+ }
+ @Transactional
+ public int update(PltProduct p) {
+ return dao.updateByPrimaryKeySelective(p);
+ }
+
+ /**
+ * 閫昏緫鍒犻櫎瀹炰綋
+ * @param id 瀹炰綋ID
+ * @return 褰卞搷璁板綍鏁伴噺
+ */
+ @Transactional
+ public int delete(Long id) {
+ return dao.deleteLogicById(id);
+ }
+
+ public PltProduct selectById(String proId) {
+ PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(proId));
+ pro=addWebUrl(pro);
+ return pro;
+ }
+
+ private PltProduct addWebUrl(PltProduct pro){
+ if(pro !=null &&pro.image!=null){
+ OthFile file = othFileMapper.selectByPrimaryKey(pro.image);
+ FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash );
+
+ pro.imageWebPath=fileRestVo.fileWebUrl +file.filePath;
+ pro.imageWebPathZip= fileOperate.getImgFileZipPath(fileRestVo.fileWebUrl +file.filePath);
+ }
+ return pro;
+ }
+
+ /**
+ * 鑾峰彇浜у搧鍒楄〃
+ */
+ public QueryResultVo<List<PltProduct>> selectSome(QueryVo queryVo) {
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+ //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟
+ Long itemTotal = dao.selectSomeCount(params);
+ QueryResultVo<List<PltProduct>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ;
+ //璁$畻鍒嗛〉绛変俊鎭�
+ rsVo.calculateAndSet(itemTotal, params);
+ //鏌ヨ绗﹀悎鏉′欢鐨勮褰�
+ rsVo.obj = dao.selectSome(params) ;
+ return rsVo ;
+ }
+
+ /**
+ * 娣诲姞浜у搧鏂囨。鍏宠仈
+ * @param proId 浜у搧id
+ * @param fileId 鏂囨。id
+ * @return 鏇存柊鏁伴噺
+ */
+ public int addDoc(long proId,long fileId){
+ PltProductFile pf=new PltProductFile();
+ pf.fileId = fileId;
+ pf.proId = proId;
+ return pfDao.insertSelective(pf);
+ }
+
+ /**
+ * 鏌ヨ浜у搧鍏宠仈鏂囨。
+ * @param proId 浜у搧id
+ * @return 杩斿洖鍏宠仈鏂囨。闆嗗悎
+ */
+ public List<OthFile> selectDoc(long proId){
+ return othFileMapper.selectByProId(proId);
+ }
+
+
+}
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/QueryVo.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/QueryVo.java
new file mode 100644
index 0000000..c67d8c3
--- /dev/null
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/QueryVo.java
@@ -0,0 +1,17 @@
+package com.dy.pmsPlatform.product;
+
+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 name;
+ public String director;
+ public String dMobile;
+ public String dt;
+}
--
Gitblit v1.8.0