feat: 标准库详情 更新记录

This commit is contained in:
super_liu
2021-07-08 22:56:50 +08:00
parent e067c8ae61
commit 0842280775
7 changed files with 310 additions and 2 deletions
@@ -1,12 +1,21 @@
package com.adc.da.slrs.sarUpdLog.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLogEOPage;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
@@ -17,7 +26,16 @@ import com.adc.da.base.web.BaseController;
*/
@RestController
@Api(description = "|SarUpdLog|")
@RequestMapping("/SarUpdLog/sar-upd-log")
@RequestMapping("/${restPath}/lawss/sarUpdLog")
public class SarUpdLogController extends BaseController<SarUpdLog> {
@Autowired
private ISarUpdLogService iSarUpdLogService;
@ApiOperation(value = "|SarUpdLogEO|查询")
@GetMapping("/getLogList")
public ResponseMessage<List<SarUpdLog>> list(SarUpdLogEOPage page) throws Exception {
page.setOrderBy("SAR_UPD_LOG.creation_time desc,id");
return Result.success(iSarUpdLogService.queryByList(page));
}
}
@@ -1,8 +1,11 @@
package com.adc.da.slrs.sarUpdLog.dao;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLogEOPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* Mapper 接口
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface SarUpdLogDao extends BaseMapper<SarUpdLog> {
List<SarUpdLog> queryByList(SarUpdLogEOPage page);
}
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -45,10 +46,13 @@ public class SarUpdLog extends BaseEntity {
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@TableField("CREATION_USER")
private String creationUser;
@ApiModelProperty(value = "创建用户名称")
@TableField(exist = false)
private String creationUserName;
}
@@ -0,0 +1,122 @@
package com.adc.da.slrs.sarUpdLog.entity;
import com.adc.da.base.page.BasePage;
/**
* <b>功能:</b>SAR_UPD_LOG SarUpdLogEOPage<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2020-12-08 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
public class SarUpdLogEOPage extends BasePage {
private String id;
private String idOperator = "=";
private String sarType;
private String sarTypeOperator = "=";
private String sarId;
private String sarIdOperator = "=";
private String content;
private String contentOperator = "=";
private String creationTime;
private String creationTime1;
private String creationTime2;
private String creationTimeOperator = "=";
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getIdOperator() {
return this.idOperator;
}
public void setIdOperator(String idOperator) {
this.idOperator = idOperator;
}
public String getSarType() {
return this.sarType;
}
public void setSarType(String sarType) {
this.sarType = sarType;
}
public String getSarTypeOperator() {
return this.sarTypeOperator;
}
public void setSarTypeOperator(String sarTypeOperator) {
this.sarTypeOperator = sarTypeOperator;
}
public String getSarId() {
return this.sarId;
}
public void setSarId(String sarId) {
this.sarId = sarId;
}
public String getSarIdOperator() {
return this.sarIdOperator;
}
public void setSarIdOperator(String sarIdOperator) {
this.sarIdOperator = sarIdOperator;
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
public String getContentOperator() {
return this.contentOperator;
}
public void setContentOperator(String contentOperator) {
this.contentOperator = contentOperator;
}
public String getCreationTime() {
return this.creationTime;
}
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public String getCreationTime1() {
return this.creationTime1;
}
public void setCreationTime1(String creationTime1) {
this.creationTime1 = creationTime1;
}
public String getCreationTime2() {
return this.creationTime2;
}
public void setCreationTime2(String creationTime2) {
this.creationTime2 = creationTime2;
}
public String getCreationTimeOperator() {
return this.creationTimeOperator;
}
public void setCreationTimeOperator(String creationTimeOperator) {
this.creationTimeOperator = creationTimeOperator;
}
}
@@ -1,8 +1,10 @@
package com.adc.da.slrs.sarUpdLog.service;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLogEOPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
@@ -15,6 +17,8 @@ import java.util.Map;
*/
public interface ISarUpdLogService extends IService<SarUpdLog> {
List<SarUpdLog> queryByList(SarUpdLogEOPage page);
void createBaseLog(String sarId, String sarType, String content) throws Exception;
void createUpdateLog(String sarType, String sarId, Map<String, Object> oldMap, Map<String, Object> newMap, String standContent) throws Exception;
@@ -4,6 +4,7 @@ import com.adc.da.common.SarTypeEnum;
import com.adc.da.slrs.sarStandAttrDetails.dao.SarStandAttrDetailsDao;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.dao.SarUpdLogDao;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLogEOPage;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.util.LoginUserUtil;
@@ -48,6 +49,11 @@ public class SarUpdLogServiceImpl extends ServiceImpl<SarUpdLogDao, SarUpdLog> i
private List<String> notCheckFieldList = Arrays.asList(notCheckField.split(","));
@Override
public List<SarUpdLog> queryByList(SarUpdLogEOPage page){
return dao.queryByList(page);
}
public void createUpdateLog (String sarType, String sarId, Map<String,Object> oldMap, Map<String,Object> newMap,String standContent) throws Exception {
SarUpdLog sarUpdLogEO = new SarUpdLog();
sarUpdLogEO.setId(UUIDUtils.randomUUID20());
@@ -1,5 +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.adc.da.slrs.sarUpdLog.dao.SarUpdLogDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
<id column="id" property="id" />
<result column="sar_type" property="sarType" />
<result column="sar_id" property="sarId" />
<result column="content" property="content" />
<result column="creation_time" property="creationTime" />
<result column="creation_user" property="creationUser" />
<result column="creationUserName" property="creationUserName" />
</resultMap>
<!-- SAR_UPD_LOG table all fields -->
<sql id="Base_Column_List" >
SAR_UPD_LOG.id, sar_type, sar_id, content, SAR_UPD_LOG.creation_time,SAR_UPD_LOG.creation_user
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="id != null" >
and id ${idOperator} #{id}
</if>
<if test="sarType != null" >
and sar_type ${sarTypeOperator} #{sarType}
</if>
<if test="sarId != null" >
and sar_id ${sarIdOperator} #{sarId}
</if>
<if test="content != null" >
and content ${contentOperator} #{content}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_UPD_LOG.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_UPD_LOG(<include refid="Base_Column_List" />)
values (#{id, jdbcType=VARCHAR}, #{sarType, jdbcType=VARCHAR}, #{sarId, jdbcType=VARCHAR}, #{content, jdbcType=CLOB}, #{creationTime, jdbcType=TIMESTAMP})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_UPD_LOG.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_UPD_LOG
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >id,</if>
<if test="sarType != null" >sar_type,</if>
<if test="sarId != null" >sar_id,</if>
<if test="content != null" >content,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="creationUser != null" >creation_user,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<if test="sarType != null" >#{sarType, jdbcType=VARCHAR},</if>
<if test="sarId != null" >#{sarId, jdbcType=VARCHAR},</if>
<if test="content != null" >#{content, jdbcType=CLOB},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
</trim>
</insert>
<!-- 根据pk,修改记录-->
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
update SAR_UPD_LOG
set sar_type = #{sarType},
sar_id = #{sarId},
content = #{content},
creation_time = #{creationTime}
where id = #{id}
</update>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
update SAR_UPD_LOG
<set >
<if test="sarType != null" >
sar_type = #{sarType},
</if>
<if test="sarId != null" >
sar_id = #{sarId},
</if>
<if test="content != null" >
content = #{content},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="creationUser != null" >
creation_user = #{creationUser},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 SAR_UPD_LOG -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_UPD_LOG
where id = #{value}
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_UPD_LOG
where id = #{value}
</delete>
<!-- SAR_UPD_LOG 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_UPD_LOG
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_UPD_LOG列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from SAR_UPD_LOG
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/>,TS_USER.uname as creationUserName from SAR_UPD_LOG
left join TS_USER on SAR_UPD_LOG.creation_user = TS_USER.usid
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
</mapper>