| | |
| | | public String SsoCurUserUrl ; |
| | | |
| | | private LogService logSv; |
| | | @Value("${pms.global.dev}") |
| | | public String isDevStage ;//是否为开发阶段 |
| | | @Autowired |
| | | public void setLogSv(LogService logSv){ |
| | | this.logSv = logSv; |
| | |
| | | |
| | | @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); |
| | |
| | | import com.dy.pmsGlobal.pojoOth.OthFile; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface OthFileMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | |
| | | int updateByPrimaryKeySelective(OthFile record); |
| | | |
| | | int updateByPrimaryKey(OthFile record); |
| | | |
| | | List<OthFile> selectByProId(long proId); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 技术负责人 |
| | | */ |
| | | public Long director; |
| | | |
| | | @TableField(exist = false) |
| | | public String directorName; |
| | | |
| | | /** |
| | | * 技术负责人手机号 |
| | | */ |
| | | public String dMobile; |
| | | |
| | | public Boolean deleted; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | public String remark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | <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 |
| | |
| | | <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--> |
| | |
| | | |
| | | <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 |
| | |
| | | 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} |
| | |
| | | </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--> |
| | |
| | | <!--@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 |
| | |
| | | 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> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
| | |
| | | package com.dy.pmsBase.role; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import com.dy.pmsGlobal.pojoBa.BaRole; |
| | | import lombok.*; |
| | | |
| | | @Data |
| | |
| | | @Builder |
| | | public class QueryVo extends QueryConditionVo { |
| | | public String name; |
| | | public boolean disable; |
| | | public boolean disabled; |
| | | public String dt; |
| | | } |
New file |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |