dongke 1 jaar geleden
bovenliggende
commit
34755fdbc0

+ 57 - 0
src/main/java/com/dk/mdm/controller/mst/PrintRemarkController.java

@@ -0,0 +1,57 @@
+package com.dk.mdm.controller.mst;
+
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.model.response.mst.OrgResponse;
+import com.dk.common.model.vo.mst.OrgVO;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.model.pojo.mst.PrintRemark;
+import com.dk.common.controller.BaseController;
+import com.dk.common.service.BaseService;
+import com.dk.mdm.model.query.mst.OrgQuery;
+import com.dk.mdm.model.query.mst.PrintRemarkQuery;
+import com.dk.mdm.model.response.mst.PrintRemarkResponse;
+import com.dk.mdm.model.vo.mst.PrintRemarkVO;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import io.swagger.annotations.Api;
+import com.dk.mdm.service.mst.PrintRemarkService;
+
+import java.util.List;
+
+@Api(tags = "打印备注设置API接口")
+@RestController
+@RequestMapping("/mst/printRemark")
+public class PrintRemarkController{
+
+    public BaseService<PrintRemark> getService() {
+        return printRemarkService;
+    }
+
+    @Autowired
+    private PrintRemarkService printRemarkService;
+
+    /**
+     * @desc   : 条件查询
+     * @author : 王英杰
+     * @date   : 2024/9/3 10:48
+     */
+    @ApiOperation( value = "分页、关联、条件查询", notes = "分页、关联、条件查询" )
+    @PostMapping({"list_by"})
+    public ResponseResultVO<List<PrintRemarkResponse>> selectByCond(@RequestBody PrintRemarkQuery printRemarkQuery) {
+        return printRemarkService.selectByCond(printRemarkQuery);
+    }
+
+    /**
+        * @desc   : 新建打印备注设置
+        * @author : 王英杰
+        * @date   : 2024/9/3 10:48
+        */
+    @ApiOperation( value = "新建打印备注设置", notes = "新建打印备注设置" )
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> insert(@RequestBody PrintRemarkVO printRemarkVO) {
+        return printRemarkService.insert(printRemarkVO);
+    }
+
+
+}

+ 27 - 0
src/main/java/com/dk/mdm/mapper/mst/PrintRemarkMapper.java

@@ -0,0 +1,27 @@
+package com.dk.mdm.mapper.mst;
+
+import com.dk.mdm.model.pojo.mst.Org;
+import com.dk.mdm.model.pojo.mst.PrintRemark;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.MoneyAccountQuery;
+import com.dk.mdm.model.query.mst.PrintRemarkQuery;
+import com.dk.mdm.model.response.mst.MoneyAccountResponse;
+import com.dk.mdm.model.response.mst.PrintRemarkResponse;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+*  打印备注设置 Mapper
+*/
+@Repository
+public interface PrintRemarkMapper extends BaseMapper<PrintRemark>{
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 宋扬
+     * @date   : 2024/3/1 10:42
+     */
+    List<PrintRemarkResponse> selectByCond(PrintRemarkQuery printRemarkQuery) ;
+}
+

+ 147 - 0
src/main/java/com/dk/mdm/mapper/mst/PrintRemarkMapper.xml

@@ -0,0 +1,147 @@
+<?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.PrintRemarkMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        setting_id, content, doc_name, flg_valid, remarks, 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.response.mst.PrintRemarkResponse">
+        <id column="setting_id" property="settingId"/>
+                <result column="content" property="content"/>
+                <result column="doc_name" property="docName"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="remarks" property="remarks"/>
+                <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="content != null and content != ''">
+                AND content = #{content}
+            </if>
+            <if test="docName != null and docName != ''">
+                AND doc_name = #{docName}
+            </if>
+            <if test="flgValid != null">
+                AND flg_valid = #{flgValid}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND remarks = #{remarks}
+            </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>
+
+    <sql id="idsForeach">
+        <!-- 根据主键settingId批量操作 -->
+        WHERE setting_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_mst_print_remark,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mst_print_remark
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_mst_print_remark,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM dkic_b.t_mst_print_remark
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 根据主键查询表t_mst_print_remark的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mst_print_remark
+        WHERE setting_id = #{id}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_mst_print_remark的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mst_print_remark
+        WHERE setting_id = #{settingId}
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_mst_print_remark的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mst_print_remark
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into dkic_b.t_mst_print_remark
+        (
+        <trim suffixOverrides=",">
+            content,
+            doc_name,
+            remarks,
+            cp_id,
+            op_app_code,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.content},
+                #{item.docName},
+                #{item.remarks},
+                #{item.cpId},
+                #{item.opAppCode},
+            </trim>
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 166 - 0
src/main/java/com/dk/mdm/model/pojo/mst/PrintRemark.java

@@ -0,0 +1,166 @@
+package com.dk.mdm.model.pojo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+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_print_remark", autoResultMap = true, schema =  "dkic_b")
+@ApiModel(value="实体类:打印备注设置", description="表名:t_mst_print_remark")
+public class PrintRemark extends PageInfo<PrintRemark> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 设置ID
+     */
+    @ApiModelProperty(value = "设置ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String settingId;
+
+
+    /**
+     * 备注内容
+     */
+    @Excel(name = "备注内容")
+    @ApiModelProperty(value = "备注内容")
+    private String content;
+
+
+    /**
+     * 业务单据
+     */
+    @Excel(name = "业务单据")
+    @ApiModelProperty(value = "业务单据")
+    private String docName;
+
+
+    /**
+     * 有效标识
+     */
+    @Excel(name = "有效标识")
+    @ApiModelProperty(value = "有效标识")
+    private Boolean flgValid;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 企业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;
+
+}

+ 81 - 0
src/main/java/com/dk/mdm/service/mst/PrintRemarkService.java

@@ -0,0 +1,81 @@
+package com.dk.mdm.service.mst;
+
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.model.response.mst.OrgResponse;
+import com.dk.common.model.vo.mst.OrgVO;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.infrastructure.convert.mst.OrgConvert;
+import com.dk.mdm.infrastructure.convert.mst.PrintRemarkConvert;
+import com.dk.mdm.model.pojo.mst.Org;
+import com.dk.mdm.model.pojo.mst.PrintRemark;
+import com.dk.mdm.mapper.mst.PrintRemarkMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.OrgQuery;
+import com.dk.mdm.model.query.mst.PrintRemarkQuery;
+import com.dk.mdm.model.response.mst.PrintRemarkResponse;
+import com.dk.mdm.model.vo.mst.PrintRemarkVO;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Service
+@Transactional
+public class PrintRemarkService extends BaseService<PrintRemark> {
+
+	@Override
+	public BaseMapper<PrintRemark> getRepository() {
+		return printRemarkMapper;
+	}
+
+	@Autowired
+	private PrintRemarkMapper printRemarkMapper;
+
+	@Autowired
+	private PrintRemarkConvert printRemarkConvert;
+
+	@Override
+	public String getPrimaryKey() {
+		return "setting_id";
+	}
+	/**
+	 * @desc : 条件查询
+	 * @author : 王英杰
+	 * @date : 2023/1/10 17:19
+	 */
+	@Pagination
+	public ResponseResultVO<List<PrintRemarkResponse>> selectByCond(PrintRemarkQuery printRemarkQuery) {
+		List<PrintRemarkResponse> list = printRemarkMapper.selectByCond(printRemarkQuery);
+
+		return ResponseResultUtil.success(list);
+	}
+
+	/**
+	 * @desc : 新建组织机构
+	 * @author : 王英杰
+	 * @date : 2024/2/27 9:17
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> insert(PrintRemarkVO printRemarkVO) {
+		List<PrintRemarkResponse> list = printRemarkMapper.selectByCond(new PrintRemarkQuery().setDocName(printRemarkVO.getDocName()).setFlgValid(true));
+		// 转化实体
+		PrintRemark printRemark = printRemarkConvert.convertToPo(printRemarkVO);
+
+           if(list != null && list.size()>0){ //说明查到了 那就编辑
+             //查到得话 也就一条 不会出现两条
+//			   PrintRemarkResponse printRemarkResponseData = list.get(0);
+			   super.updateByUuid(printRemark);
+		   }else{//没查到 就新建
+			   super.insert(printRemark);
+		   }
+		return ResponseResultUtil.success();
+
+	}
+
+}