ソースを参照

1、增加表格设置

zhoux 1 年間 前
コミット
fb1f12bd1e

+ 49 - 0
src/main/java/com/dk/mdm/controller/mst/TableSetController.java

@@ -0,0 +1,49 @@
+package com.dk.mdm.controller.mst;
+
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.model.pojo.mst.TableSet;
+import com.dk.common.service.BaseService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.Api;
+import com.dk.mdm.service.mst.TableSetService;
+
+@Api(tags = "用户表格设置API接口")
+@RestController
+@RequestMapping("/mst/tableSet")
+public class TableSetController{
+
+    public BaseService<TableSet> getService() {
+        return tableSetService;
+    }
+
+    @Autowired
+    private TableSetService tableSetService;
+
+    /**
+     * @desc : 条件查询
+     * @author : 周兴
+     * @date : 2024/7/31 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<TableSet>> selectByCond(@RequestBody TableSet tableSet) {
+        return tableSetService.selectByCond(tableSet);
+    }
+
+    /**
+     * @desc : 保存表格设置
+     * @author : 周兴
+     * @date : 2024/7/31 9:39
+     */
+    @ApiOperation( value = "新建", notes = "新建" )
+    @PostMapping({"save_table_set"})
+    public ResponseResultVO<?> saveTableSet(@RequestBody TableSet tableSet) {
+        return tableSetService.saveTableSet(tableSet);
+    }
+}

+ 20 - 0
src/main/java/com/dk/mdm/mapper/mst/TableSetMapper.java

@@ -0,0 +1,20 @@
+package com.dk.mdm.mapper.mst;
+
+import com.dk.mdm.model.pojo.mst.Supplier;
+import com.dk.mdm.model.pojo.mst.TableSet;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+*  用户表格设置 Mapper
+*/
+@Repository
+public interface TableSetMapper extends BaseMapper<TableSet>{
+    /**
+     * @desc   : 保存用户表格设置
+     * @author : 周兴
+     * @date   : 2024/7/31 17:49
+     */
+    int saveTableSet(TableSet tableSet);
+}
+

+ 124 - 0
src/main/java/com/dk/mdm/mapper/mst/TableSetMapper.xml

@@ -0,0 +1,124 @@
+<?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.dk.mdm.mapper.mst.TableSetMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        staff_id, code, table_ref, columns, remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.TableSet">
+        <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+        <result column="code" property="code"/>
+        <result column="table_ref" property="tableRef"/>
+        <result column="columns" property="columns" typeHandler="JsonTypeHandler"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
+        <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
+        <result column="op_app_code" property="opAppCode"/>
+        <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+        <result column="op_db_user" property="opDbUser"/>
+    </resultMap>
+
+    <!-- 通用条件列 -->
+    <sql id="Condition">
+        <where>
+            <if test="staffId != null and staffId != ''">
+                AND staff_id = #{staffId}
+            </if>
+            <if test="code != null and code != ''">
+                AND code = #{code}
+            </if>
+            <if test="tableRef != null and tableRef != ''">
+                AND table_ref = #{tableRef}
+            </if>
+            <if test="columns != null and columns != ''">
+                AND columns = #{columns}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND remarks = #{remarks}
+            </if>
+            <if test="flgValid != null">
+                AND flg_valid = #{flgValid}
+            </if>
+            <if test="cpId != null">
+                AND cp_id = #{cpId}
+            </if>
+            <if test="opCreateTime != null">
+                AND op_create_time = #{opCreateTime}
+            </if>
+            <if test="opCreateUserId != null and opCreateUserId != ''">
+                AND op_create_user_id = #{opCreateUserId}
+            </if>
+            <if test="opUpdateTime != null">
+                AND op_update_time = #{opUpdateTime}
+            </if>
+            <if test="opUpdateUserId != null and opUpdateUserId != ''">
+                AND op_update_user_id = #{opUpdateUserId}
+            </if>
+            <if test="opAppCode != null and opAppCode != ''">
+                AND op_app_code = #{opAppCode}
+            </if>
+            <if test="opTimestamp != null">
+                AND op_timestamp = #{opTimestamp}
+            </if>
+            <if test="opDbUser != null and opDbUser != ''">
+                AND op_db_user = #{opDbUser}
+            </if>
+        </where>
+    </sql>
+
+    <!-- 查询表t_mst_table_set,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_table_set
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_mst_table_set,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM t_mst_table_set
+        <include refid="Condition"/>
+    </select>
+
+    <!--新建编辑表格设置-->
+    <insert id="saveTableSet">
+        insert into dkic_b.t_mst_table_set
+        (
+        <trim suffixOverrides=",">
+            staff_id,
+            code,
+            table_ref,
+            cp_id,
+            columns,
+            remarks,
+        </trim>
+        )
+        values
+        (
+        <trim suffixOverrides=",">
+            #{staffId} ::uuid,
+            #{code},
+            #{tableRef},
+            #{cpId},
+            #{columns,typeHandler=JsonTypeHandler},
+            #{remarks},
+        </trim>
+        )
+        on conflict (staff_id,code,table_ref) do update set
+        columns = excluded."columns";
+    </insert>
+
+</mapper>

+ 178 - 0
src/main/java/com/dk/mdm/model/pojo/mst/TableSet.java

@@ -0,0 +1,178 @@
+package com.dk.mdm.model.pojo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.*;
+import java.io.Serializable;
+
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.*;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.time.LocalDateTime;
+
+/**
+ *  用户表格设置
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("用户表格设置")
+@TableName(value = "t_mst_table_set", autoResultMap = true,schema = "dkic_b")
+@ApiModel(value="实体类:用户表格设置", description="表名:t_mst_table_set")
+public class TableSet extends PageInfo<TableSet> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+
+    /**
+     * 用户ID
+     */
+    @Excel(name = "用户ID")
+    @ApiModelProperty(value = "用户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 页面编码
+     */
+    @Excel(name = "页面编码")
+    @ApiModelProperty(value = "页面编码")
+    private String code;
+
+
+    /**
+     * 表格名称
+     */
+    @Excel(name = "表格名称")
+    @ApiModelProperty(value = "表格名称")
+    private String tableRef;
+
+
+    /**
+     * 表格列 (记录显示列和隐藏列)
+     */
+    @Excel(name = "表格列 (记录显示列和隐藏列)")
+    @ApiModelProperty(value = "表格列 (记录显示列和隐藏列)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONArray columns;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 64 - 0
src/main/java/com/dk/mdm/service/mst/TableSetService.java

@@ -0,0 +1,64 @@
+package com.dk.mdm.service.mst;
+
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.infrastructure.util.AuthUtils;
+import com.dk.mdm.model.pojo.mst.TableSet;
+import com.dk.mdm.mapper.mst.TableSetMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.GoodsSkuQuery;
+import com.dk.mdm.model.response.mst.GoodsSkuResponse;
+import com.dk.mdm.service.common.CommonService;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class TableSetService extends BaseService<TableSet> {
+
+	@Override
+	public BaseMapper<TableSet> getRepository() {
+		return tableSetMapper;
+	}
+
+	@Autowired
+	private TableSetMapper tableSetMapper;
+
+	/**
+	 * @desc   : 重写主键
+	 * @author : 周兴
+	 * @date   : 2024/7/31 14:51
+	 */
+	@Override
+	public String getPrimaryKey() {
+		return "set_id";
+	}
+
+	/**
+	 * @desc : 查询
+	 * @author : 周兴
+	 * @date : 2024/7/31 9:39
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<TableSet>> selectByCond(TableSet tableSet) {
+		return super.mergeListWithCount(tableSet, tableSetMapper.selectByCond(tableSet),
+				tableSetMapper.countByCond(tableSet));
+	}
+
+	/**
+	 * @desc : 保存表格设置
+	 * @author : 周兴
+	 * @date : 2023/3/28 13:22
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> saveTableSet(TableSet tableSet) {
+		tableSetMapper.saveTableSet(tableSet);
+		return ResponseResultUtil.success(tableSet);
+	}
+}