Merge branch 'feature/qt' into develop

This commit is contained in:
钱涛 2022-03-11 17:15:43 +08:00
commit dded82ac7c
10 changed files with 693 additions and 21 deletions

View File

@ -4,13 +4,19 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.AddUpDeductionBiz;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWorkbook> {
@ -27,6 +33,7 @@ public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWor
@Override
public XSSFWorkbook execute(CommandContext commandContext) {
AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam");
EmployBiz employBiz = new EmployBiz();
AddUpDeductionBiz biz = new AddUpDeductionBiz();
Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId();
@ -39,6 +46,19 @@ public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWor
throw new SalaryRunTimeException(String.format("累计专项附加扣除不存在"+"[id:%s]", id));
}
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
//查询参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
XSSFWorkbook workbook = biz.exportDetail(queryParam);
return workbook;

View File

@ -57,7 +57,13 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
throw new SalaryRunTimeException("员工信息不存在");
}
//查询参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String fields = " t1.id," +
" t1.declare_month as declareMonth," +
@ -98,12 +104,6 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
private String makeSqlWhere(AddUpDeductionQueryParam queryParam) {
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0";
Collection<Long> ids = queryParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {

View File

@ -4,13 +4,19 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.AddUpSituationBiz;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class AddUpSituationExportDetailCmd extends AbstractCommonCommand<XSSFWorkbook> {
@ -28,7 +34,7 @@ public class AddUpSituationExportDetailCmd extends AbstractCommonCommand<XSSFWor
public XSSFWorkbook execute(CommandContext commandContext) {
AddUpSituationQueryParam queryParam = (AddUpSituationQueryParam) params.get("queryParam");
AddUpSituationBiz biz = new AddUpSituationBiz();
EmployBiz employBiz = new EmployBiz();
Long id = queryParam.getAccumulatedSituationId();
if (id == null) {
@ -40,6 +46,19 @@ public class AddUpSituationExportDetailCmd extends AbstractCommonCommand<XSSFWor
throw new SalaryRunTimeException(String.format("累计情况不存在"+"[id:%s]", id));
}
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
//查询参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> taxYearMonths = queryParam.getTaxYearMonth();
if (CollectionUtils.isNotEmpty(taxYearMonths)) {
queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
XSSFWorkbook workbook = biz.exportDetail(queryParam);
return workbook;
}

View File

@ -57,6 +57,14 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand<Map<St
throw new SalaryRunTimeException("员工信息不存在");
}
//构建查询参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> taxYearMonths = queryParam.getTaxYearMonth();
if (CollectionUtils.isNotEmpty(taxYearMonths)) {
queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String fields = " t1.id," +
" t1.tax_year_month," +
@ -94,7 +102,7 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand<Map<St
SalaryWeaTable<AddUpSituationRecordDTO> table = new SalaryWeaTable<AddUpSituationRecordDTO>(user, AddUpSituationRecordDTO.class);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
table.setSqlwhere(makeSqlWhere(queryParam));
table.setSqlorderby("t1.id DESC");
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
@ -106,14 +114,8 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand<Map<St
}
private String makeSqlWhere() {
private String makeSqlWhere(AddUpSituationQueryParam queryParam) {
AddUpSituationQueryParam queryParam = (AddUpSituationQueryParam) params.get("queryParam");
//申报月份
List<String> taxYearMonths = queryParam.getTaxYearMonth();
if (CollectionUtils.isNotEmpty(taxYearMonths)) {
queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0 AND e.status not in (7)";
Collection<Long> ids = queryParam.getIds();

View File

@ -3,14 +3,20 @@ package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class OtherDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWorkbook> {
@ -28,6 +34,7 @@ public class OtherDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWor
public XSSFWorkbook execute(CommandContext commandContext) {
OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam");
OtherDeductionBiz biz = new OtherDeductionBiz();
EmployBiz employBiz = new EmployBiz();
Long id = queryParam.getOtherTaxExemptDeductionId();
if (id == null) {
@ -39,6 +46,20 @@ public class OtherDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWor
throw new SalaryRunTimeException(String.format("其他免税扣除不存在"+"[id:%s]", id));
}
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
//构建参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
XSSFWorkbook workbook = biz.exportDetail(queryParam);
return workbook;

View File

@ -57,7 +57,13 @@ public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
throw new SalaryRunTimeException("员工信息不存在");
}
//构建参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String fields = " t1.id," +
" t1.declare_month as declareMonth," +
@ -97,12 +103,6 @@ public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
private String makeSqlWhere(OtherDeductionQueryParam queryParam) {
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0";
Collection<Long> ids = queryParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {

View File

@ -0,0 +1,50 @@
package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.SalaryTableColumn;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 数据采集-考勤引用字段列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuoteFieldListDTO {
//主键id
@JsonSerialize(using = ToStringSerializer.class)
@SalaryTableColumn(column = "id", display = false)
private Long id;
@SalaryTableColumn(text = "字段名称", width = "10%", column = "fieldName")
private String fieldName;
//来源1自定义2考勤模块
@SalaryTableColumn(text = "来源", width = "10%", column = "sourceType")
private String sourceType;
//来源1自定义2考勤模块
private String sourceTypeValue;
//字段类型1数值2文本
@SalaryTableColumn(text = "类型", width = "10%", column = "fieldType")
private String fieldType;
//是否启用01
@SalaryTableColumn(text = "是否启用", width = "10%", column = "enableStatus")
private Integer enableStatus;
//备注
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
private String description;
}

View File

@ -0,0 +1,67 @@
package com.engine.salary.entity.datacollection.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 考勤引用字段表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuoteFieldPO {
/**
* 主键
*/
private Long id;
/**
* 字段名称
*/
private String fieldName;
/**
* 来源1自定义2考勤模块
*/
private Integer sourceType;
/**
* 字段类型1数值2文本
*/
private Integer fieldType;
/**
* 是否启用01
*/
private Integer enableStatus;
/**
* 编码对应考勤模块字段
*/
private String code;
/**
* 备注
*/
private String description;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private Long creator;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
/**
* 租户ID
*/
private String tenantKey;
}

View File

@ -0,0 +1,91 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface AttendQuoteFieldMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<AttendQuoteFieldPO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
AttendQuoteFieldPO getById(Long id);
/**
* 新增忽略null字段
*
* @param AttendQuoteFieldPO 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(AttendQuoteFieldPO AttendQuoteFieldPO);
/**
* 修改修改所有字段
*
* @param AttendQuoteFieldPO 修改的记录
* @return 返回影响行数
*/
int update(AttendQuoteFieldPO AttendQuoteFieldPO);
/**
* 修改忽略null字段
*
* @param AttendQuoteFieldPO 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(AttendQuoteFieldPO AttendQuoteFieldPO);
/**
* 删除记录
*
* @param AttendQuoteFieldPO 待删除的记录
* @return 返回影响行数
*/
int delete(AttendQuoteFieldPO AttendQuoteFieldPO);
/**
* 查询数据采集-考勤引用字段列表
* @param param
* @return
*/
List<AttendQuoteFieldListDTO> list(@Param("param") AttendQuoteFieldQueryParam param);
/**
* 批量删除数据采集-考勤引用字段
* @param ids
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
/**
* 插入
* @param saves
*/
void saveBatch(@Param("saves") List<AttendQuoteFieldPO> saves);
/**
* 更新字段名
* @param updates
*/
void updateNameByCode(@Param("updates") List<AttendQuoteFieldPO> updates);
}

View File

@ -0,0 +1,402 @@
<?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.engine.salary.mapper.datacollection.AttendQuoteFieldMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO">
<result column="id" property="id"/>
<result column="field_name" property="fieldName"/>
<result column="source_type" property="sourceType"/>
<result column="field_type" property="fieldType"/>
<result column="enable_status" property="enableStatus"/>
<result column="code" property="code"/>
<result column="description" property="description"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.field_name
, t.source_type
, t.field_type
, t.enable_status
, t.code
, t.description
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_attend_quote_field t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_attend_quote_field t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_attend_quote_field
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="fieldName != null">
field_name,
</if>
<if test="sourceType != null">
source_type,
</if>
<if test="fieldType != null">
field_type,
</if>
<if test="enableStatus != null">
enable_status,
</if>
<if test="code != null">
code,
</if>
<if test="description != null">
description,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="fieldName != null">
#{fieldName},
</if>
<if test="sourceType != null">
#{sourceType},
</if>
<if test="fieldType != null">
#{fieldType},
</if>
<if test="enableStatus != null">
#{enableStatus},
</if>
<if test="code != null">
#{code},
</if>
<if test="description != null">
#{description},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO">
UPDATE hrsa_attend_quote_field
<set>
field_name=#{fieldName},
source_type=#{sourceType},
field_type=#{fieldType},
enable_status=#{enableStatus},
code=#{code},
description=#{description},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO">
UPDATE hrsa_attend_quote_field
<set>
<if test="fieldName != null">
field_name=#{fieldName},
</if>
<if test="sourceType != null">
source_type=#{sourceType},
</if>
<if test="fieldType != null">
field_type=#{fieldType},
</if>
<if test="enableStatus != null">
enable_status=#{enableStatus},
</if>
<if test="code != null">
code=#{code},
</if>
<if test="description != null">
description=#{description},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO">
UPDATE hrsa_attend_quote_field
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<sql id="attendQuoteFieldColumn">
t1
.
id
,
t1.field_name,
t1.source_type,
t1.field_type,
t1.enable_status,
t1.description
</sql>
<sql id="paramSql">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.fieldName != null and param.fieldName != ''">
AND t1.field_name like CONCAT('%',#{param.fieldName},'%')
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.fieldName != null and param.fieldName != ''">
AND t1.field_name like '%'||#{param.fieldName}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.fieldName != null and param.fieldName != ''">
AND t1.field_name like '%'+#{param.fieldName}+'%'
</if>
</sql>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO">
SELECT
<include refid="attendQuoteFieldColumn"/>
FROM
hrsa_attend_quote_field t1
WHERE
t1.tenant_key = #{tenantKey} AND t1.delete_type = 0
<include refid="paramSql"/>
ORDER BY t1.source_type,t1.id DESC
</select>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO"
databaseId="oracle">
SELECT
t1.id,
t1.field_name,
t1.source_type,
t1.field_type,
t1.enable_status,
t1.description
FROM
hrsa_attend_quote_field t1
WHERE
t1.tenant_key = #{tenantKey} AND t1.delete_type = 0
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.fieldName != null and param.fieldName != ''">
AND t1.field_name like '%'||#{param.fieldName}||'%'
</if>
ORDER BY t1.source_type,t1.id DESC
</select>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO"
databaseId="sqlserver">
SELECT
t1.id,
t1.field_name,
t1.source_type,
t1.field_type,
t1.enable_status,
t1.description
FROM
hrsa_attend_quote_field t1
WHERE
t1.tenant_key = #{tenantKey} AND t1.delete_type = 0
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.fieldName != null and param.fieldName != ''">
AND t1.field_name like '%'+#{param.fieldName}+'%'
</if>
ORDER BY t1.source_type,t1.id DESC
</select>
<insert id="saveBatch">
INSERT INTO hrsa_attend_quote_field
(id,field_name,source_type,field_type,enable_status,code,description,create_time,update_time,creator,delete_type,tenant_key)
VALUES
<foreach collection="saves" item="item" separator=",">
(
#{item.id},
#{item.fieldName},
#{item.sourceType},
#{item.fieldType},
#{item.enableStatus},
#{item.code},
#{item.description},
#{item.createTime},#{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}
)
</foreach>
</insert>
<insert id="saveBatch" databaseId="oracle">
INSERT INTO hrsa_attend_quote_field
(id,field_name,source_type,field_type,enable_status,code,description,create_time,update_time,creator,delete_type,tenant_key)
<foreach collection="saves" item="item" separator="union all">
select
#{item.id},
#{item.fieldName},
#{item.sourceType},
#{item.fieldType},
#{item.enableStatus},
#{item.code},
#{item.description},
#{item.createTime},#{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="saveBatch" databaseId="sqlserver">
INSERT INTO hrsa_attend_quote_field
(id,field_name,source_type,field_type,enable_status,code,description,create_time,update_time,creator,delete_type,tenant_key)
VALUES
<foreach collection="saves" item="item" separator=",">
(
#{item.id},
#{item.fieldName},
#{item.sourceType},
#{item.fieldType},
#{item.enableStatus},
#{item.code},
#{item.description},
#{item.createTime},#{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}
)
</foreach>
</insert>
<update id="updateNameByCode" parameterType="java.util.List">
update hrsa_attend_quote_field
<trim prefix="set" suffixOverrides=",">
<trim prefix="field_name =case" suffix="end,">
<foreach collection="updates" item="item" index="index">
<if test="item.fieldName!=null">
when code=#{item.code} then #{item.fieldName}
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="updates" item="item" index="index">
<if test="item.updateTime!=null">
when code=#{item.code} then #{item.updateTime}
</if>
</foreach>
</trim>
</trim>
where
<!-- <foreach collection="updates" separator="or" item="item" index="index" >-->
<!-- code=#{item.code}-->
<!-- </foreach>-->
code in
<foreach collection="updates" item="item" index="index" separator="," open="(" close=")">
#{item.code}
</foreach>
</update>
</mapper>