操作日志

This commit is contained in:
hecan 2024-06-11 10:14:38 +08:00
parent e928c8de00
commit aa6da4bf77
4 changed files with 266 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package com.hzya.frame.sysnew.comparison.controlsLog.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity;
public interface IControlsLogDao extends IBaseDao<ControlsLogEntity, String> {
/**
*
* @content 操作日志保存
* @Param formmainId:主表id,sourceName来源名称code来源编码,sourceData:源数据,optionType:操作类型,optionName:操作人,dbName:数据库名称
* @Return
* @Author hecan
* @Date 2024/6/5 15:29
* **/
@DS("master")
ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName);
}

View File

@ -0,0 +1,32 @@
package com.hzya.frame.sysnew.comparison.controlsLog.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.sysnew.comparison.controlsLog.dao.IControlsLogDao;
import com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity;
import com.hzya.frame.uuid.UUIDUtils;
import org.springframework.stereotype.Repository;
@Repository(value = "controlsLogDaoImpl")
public class ControlsLogDaoImpl extends MybatisGenericDao<ControlsLogEntity, String> implements IControlsLogDao {
//操作日志新增
@Override
@DS("master")
public ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName) {
ControlsLogEntity controlsLogEntity=new ControlsLogEntity();
controlsLogEntity.setId(UUIDUtils.getUUID());
controlsLogEntity.setFormmainId(formmainId);
controlsLogEntity.setSourceName(sourceName);
controlsLogEntity.setCode(code);
controlsLogEntity.setSourceData(sourceData);
controlsLogEntity.setOptionType(optionType);
controlsLogEntity.setOptionName(optionName);
controlsLogEntity.setDbName(dbName);
controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
controlsLogEntity.setOrg_id("0");
ControlsLogEntity save = super.save(getSqlIdPrifx() + "saveControlsLog", controlsLogEntity);
return save;
}
}

View File

@ -0,0 +1,78 @@
package com.hzya.frame.sysnew.comparison.controlsLog.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
*
* @content 操作日志实体类
* @Param
* @Return
* @Author hecan
* @Date 2024/6/5 11:58
* **/
public class ControlsLogEntity extends BaseEntity {
private String formmainId;//主表id
private String sourceName;//来源名称
private String code;//编码
private String sourceData;//源数据
private String optionType;//操作类型
private String optionName;//操作人
private String dbName;//表名称
public String getDbName() {
return dbName;
}
public void setDbName(String dbName) {
this.dbName = dbName;
}
public String getFormmainId() {
return formmainId;
}
public void setFormmainId(String formmainId) {
this.formmainId = formmainId;
}
public String getSourceName() {
return sourceName;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getSourceData() {
return sourceData;
}
public void setSourceData(String sourceData) {
this.sourceData = sourceData;
}
public String getOptionType() {
return optionType;
}
public void setOptionType(String optionType) {
this.optionType = optionType;
}
public String getOptionName() {
return optionName;
}
public void setOptionName(String optionName) {
this.optionName = optionName;
}
}

View File

@ -0,0 +1,136 @@
<?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.hzya.frame.sysnew.comparison.controlsLog.dao.impl.ControlsLogDaoImpl">
<resultMap id="get-ComparisonEntity-result" type="com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="formmainId" column="formmain_id" jdbcType="VARCHAR"/>
<result property="sourceName" column="source_name" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="sourceData" column="source_data" jdbcType="TIMESTAMP"/>
<result property="optionType" column="option_type" jdbcType="VARCHAR"/>
<result property="optionName" column="option_name" jdbcType="TIMESTAMP"/>
</resultMap>
<!--分页查询数据-->
<select id="list_base" resultMap="get-ComparisonEntity-result"
parameterType = "com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity">
select * from ${dbName}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">and id = #{id}</if>
<if test="formmainId != null and formmainId != ''">and formmain_id = #{formmainId}</if>
<if test="code != null and code != ''">and code = #{code}</if>
<if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if>
<if test="sourceData != null and sourceData != ''">and source_data = #{sourceData}</if>
<if test="optionType != null and optionType != ''">and option_type = #{optionType}</if>
<if test="optionName != null and optionName != ''">and option_name = #{optionName}</if>
<if test="sorts != null">and sorts = #{sorts}</if>
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
<if test="create_time != null">and create_time = #{create_time}</if>
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
<if test="modify_time != null">and modify_time = #{modify_time}</if>
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
and sts='Y'
</trim>
</select>
<!--新增档案数据-->
<insert id="saveControlsLog" parameterType = "com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity">
insert into ${dbName}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="formmainId != null and formmainId != ''">formmain_id,</if>
<if test="code != null and code != ''">code ,</if>
<if test="sourceName != null and sourceName != ''">source_name ,</if>
<if test="sourceData != null and sourceData != ''">source_data ,</if>
<if test="optionType != null and optionType != ''">option_type ,</if>
<if test="optionName != null and optionName != ''">option_name ,</if>
<if test="sorts == null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
create_time,
modify_time,
sts
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="formmainId != null and formmainId != ''">#{formmainId},</if>
<if test="code != null and code != ''">#{code} ,</if>
<if test="sourceName != null and sourceName != ''">#{sourceName} ,</if>
<if test="sourceData != null and sourceData != ''">#{sourceData} ,</if>
<if test="optionType != null and optionType != ''">#{optionType} ,</if>
<if test="optionName != null and optionName != ''">#{optionName} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ${dbName} a WHERE a.sts = 'Y' ),</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="create_time == null">now() ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="modify_time == null"> now() ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="sts == null ">'Y'</if>
</trim>
</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity" >
update ${dbName} set
<trim suffix="" suffixOverrides=",">
<if test="formmainId != null and formmainId != ''"> formmain_id = #{formmainId},</if>
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
<if test="code != null and code != ''"> code = #{code},</if>
<if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if>
<if test="optionType != null and optionType != ''"> option_type = #{optionType},</if>
<if test="optionName != null and optionName != ''"> option_name = #{optionName},</if>
<if test="sorts != null"> sorts = #{sorts},</if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="modify_time == null"> modify_time = now(),</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId}</if>
</trim>
where id=#{id} and sts='Y'
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_delete" parameterType = "com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity" >
update
${dbName}
set sts= 'N' ,modify_time = now(),modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="formmainId != null and formmainId != ''"> formmain_id = #{formmainId},</if>
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
<if test="code != null and code != ''"> code = #{code},</if>
<if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if>
<if test="optionType != null and optionType != ''"> option_type = #{optionType},</if>
<if test="optionName != null and optionName != ''"> option_name = #{optionName},</if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and id=#{id} and sts='Y'
</trim>
</update>
</mapper>