Commit 56646b51 by dengwei

权重数据填报功能

parent 2b585dc7
......@@ -60,6 +60,8 @@ public class Constants {
*/
public static final String LOG_INDICATOR_WEIGHTCFG_API = "indicator.weightcfg";
public static final String LOG_INDICATOR_WEIGHT_DATA_ENTER_API = "indicator.weightdataenter";
/**
*短板管理结果汇总
**/
......
package com.keymobile.indicators.model.entity.weight;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
/**
* @author DW
* @date 2023-02-26-0026 16:07
* @description 对标主体得分指标权重明细表
*/
@Data
@Table(name = "obj_score_ind_weight_detail")
public class ObjScoreIndWeightDetail {
// 表主键ID有问题
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
// 配置主表ID
private Integer cfgId;
// 租户组织CODE,区分不同单位
private String code;
// 配置级别
private String levelName;
// 配置周期
private String dataValue;
// 对标主体CODE
private String orgNo;
// 对标主体name
private String orgName;
// 对标主体类型-两烟区-纯销区
private String orgType;
// 指标ID
private String indId;
// 指标名称
private String indName;
// 权重
private BigDecimal weight;
// 指标综合评价权重
private BigDecimal indWeight;
// 指标改善提升权重
private BigDecimal indImproveWeight;
// 两烟区大类权重
private BigDecimal weightTwo;
// 纯销区大类权重
private BigDecimal weightOne;
// 大类权重
private BigDecimal bigWeight;
}
package com.keymobile.indicators.model.entity.weight;
import com.keymobile.indicators.model.entity.BaseModel;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author DW
* @date 2023-02-23-0023 15:10
* @description
*/
@Data
@Table(name="weight_data_excel_ind")
public class WeightExcelIndicator extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 关联模板id
*/
private Integer tempId;
/**
* 关联指标id
*/
private String indId;
/**
* 指标名称
*/
private String indName;
/**
* 指标单位
*/
private String indUnit;
/**
* 指标数量来源:1 Excel导入 2 手工录入
*/
private Integer indSource;
/**
* 顺序号
*/
private Integer orderNum;
}
package com.keymobile.indicators.model.entity.weight;
import com.keymobile.indicators.model.entity.BaseModel;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author DW
* @date 2023-02-23-0023 15:11
* @description
*/
@Data
@Table(name="weight_data_excel_obj")
public class WeightExcelObj extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 关联模板id
*/
private Integer tempId;
/**
* 对象id
*/
private String objId;
/**
* 对象名
*/
private String objName;
/**
* 对象类型:1、组织 2、人员 3、数据项
*/
private Integer objType;
/**
* 顺序号
*/
private Integer orderNum;
}
package com.keymobile.indicators.model.entity.weight;
import com.keymobile.indicators.model.entity.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
/**
* @author DW
* @date 2023-02-23-0023 15:09
* @description
*/
@Data
@Table(name = "weight_data_excel_temp")
@ApiModel("excel模板定义")
public class WeightExcelTemplate extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@ApiModelProperty("权重ID")
private Integer weightId;
/**
* 模板名字
*/
@ApiModelProperty("模板名字")
private String name;
/**
* 列类型
*/
@ApiModelProperty("列类型:1、指标 2 考核对象" )
private Integer ctype;
/**
* 所属组织机构
*/
@ApiModelProperty("所属组织机构")
private String orgNo;
@ApiModelProperty("数据项列表")
@Transient
private List<WeightExcelIndicator> inds;
@ApiModelProperty("考核对象列表")
@Transient
private List<WeightExcelObj> objs;
}
package com.keymobile.indicators.model.entity.weight;
import com.keymobile.indicators.model.entity.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
/**
* @author DW
* @date 2023-02-22-0022 15:35
* @description 权重指标数据实体-用于权重配置中在线填报功能使用
*/
@Data
@Table(name="weight_ind_value")
public class WeightIndValue extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
// 权重配置ID
private Integer weightId;
// 考核指标ID
private String indId;
// 考核指标名称
private String indName;
// 考核指标单位
private String indUnit;
/**
* 指标数量来源:1 Excel导入 2 手工录入
*/
private Integer indSource;
// 综合评价权重
private BigDecimal synthesizeWeight;
// 改善提升权重
private BigDecimal improveWeight;
// 维度权重
private BigDecimal dimensionWeight;
/**
* 数据对象id
*/
@ApiModelProperty("数据对象id")
private String objId;
/**
* 数据对象类型:1、组织机构 2、人员
*/
@ApiModelProperty("数据对象类型:1、组织机构 2、人员 3、岗位")
private Integer objType;
/**
* 数据项对象名称
*/
@ApiModelProperty("数据对象名称")
private String objName;
@ApiModelProperty("备注")
private String description;
/**
* excel导入对应的excel模板id
*/
private Integer tempId;
}
package com.keymobile.indicators.model.mapper.weight;
import com.keymobile.indicators.model.entity.weight.ObjScoreIndWeightDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.BaseMapper;
import java.util.List;
@Mapper
public interface ObjScoreIndWeightDetailMapper extends BaseMapper<ObjScoreIndWeightDetail> {
/**
* 批量插入填报值
* @param valueList
*/
void batchInsert(@Param("valueList") List<ObjScoreIndWeightDetail> valueList);
/**
* 根据权重配置ID删除权重数据填报
* @param cfgId 权重配置ID
*/
void deleteByCfgId(@Param("cfgId") Integer cfgId);
}
package com.keymobile.indicators.model.mapper.weight;
import com.keymobile.indicators.model.entity.weight.WeightExcelIndicator;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;
import java.util.List;
@Mapper
public interface WeightExcelIndicatorMapper extends BaseMapper<WeightExcelIndicator> {
/**
* 查询模板关联的指标信息
* @param tempId
* @return
*/
List<WeightExcelIndicator> getByTempId(Integer tempId);
/**
* 根据模板id删除指标信息
* @param tempId
*/
void deleteByTempId(Integer tempId);
}
package com.keymobile.indicators.model.mapper.weight;
import com.keymobile.indicators.model.entity.weight.WeightExcelObj;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;
import java.util.List;
@Mapper
public interface WeightExcelObjMapper extends BaseMapper<WeightExcelObj> {
/**
* 查询模板关联的考核对象信息
* @param tempId
* @return
*/
List<WeightExcelObj> getByTempId(Integer tempId);
/**
* 根据模板id删除考核对象信息
* @param tempId
*/
void deleteByTempId(Integer tempId);
}
package com.keymobile.indicators.model.mapper.weight;
import com.keymobile.indicators.model.entity.weight.WeightExcelTemplate;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface WeightExcelTemplateMapper extends BaseMapper<WeightExcelTemplate> {
/**
* 逻辑删除模板
* @param id
*/
void deleteById(Integer id);
/**
* 根据权重id获取excel模板
* @param weightId
* @return
*/
WeightExcelTemplate getByWeightId(Integer weightId);
/**
* 根据权重ID删除权重模板
* @param weightId 权重ID
*/
void deleteByWeightId(Integer weightId);
}
package com.keymobile.indicators.model.mapper.weight;
import com.keymobile.indicators.model.entity.weight.WeightIndValue;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.BaseMapper;
import java.util.List;
@Mapper
public interface WeightIndValueMapper extends BaseMapper<WeightIndValue> {
/**
* 批量插入填报值
* @param valueList
*/
void batchInsert(@Param("valueList") List<WeightIndValue> valueList);
/**
* 根据 指标id 机构编码 时间维度删除
* @param newValues
**/
void batchDelete(@Param("newValues") List<WeightIndValue> newValues);
/**
* 根据权重配置ID删除权重数据填报
* @param weightId 权重配置ID
*/
void deleteByWeightId(@Param("weightId") Integer weightId);
/**
* 根据权重配置ID查询权重数据填报
* @param weightId 权重配置ID
* @return 权重数据填报集合
*/
List<WeightIndValue> findByWeightId(@Param("weightId") Integer weightId);
}
......@@ -2,11 +2,16 @@ package com.keymobile.indicators.service.impl;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg;
import com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj;
import com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator;
import com.keymobile.indicators.model.entity.indicators.DriveIndDef;
import com.keymobile.indicators.model.entity.weight.WeightIndValue;
import com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper;
import com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper;
import com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper;
import com.keymobile.indicators.service.ObjScoreIndWeightCfgService;
import com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService;
import com.keymobile.indicators.service.weightDataEnter.WeightIndValueService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,6 +39,12 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
private ObjScoreIndWeightCfgMapper weightCfgMapper;
@Autowired
private DriveIndDefMapper driveIndDefMapper;
@Autowired
private WeightIndValueMapper weightIndValueMapper;
@Autowired
private TaskRuleGroupObjService taskRuleGroupObjService;
@Autowired
private WeightIndValueService weightIndValueService;
@Override
public void deleteById(Integer id) {
......@@ -82,6 +93,30 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
public void updateWeight(ObjScoreIndWeightCfg weightCfg) {
weightCfg.setState(Constants.DATA_STATE_A);
weightCfgMapper.updateByPrimaryKey(setIndMsg(weightCfg));
updateWeightIndValue(weightCfg);
}
/**
* 根据权重配置更新数据填报结果表
* @param weightCfg 权重配置信息
*/
private void updateWeightIndValue(ObjScoreIndWeightCfg weightCfg) {
List<WeightIndValue> values = weightIndValueMapper.findByWeightId(weightCfg.getId());
// 判断权重是否已经填报过数据,没有填报过数据的权重无需此操作
// 填报过的权重配置需要同步更新维度权重
if (values != null && values.size() > 0) {
// 获取两烟区单位
// 两烟区单位
TaskRuleGroupObj twoGroupObj = taskRuleGroupObjService.getById(weightCfg.getWeightTwoUnit());
for (WeightIndValue value : values) {
if (StringUtils.contains(twoGroupObj.getDetailNames(), value.getObjName())) {
value.setDimensionWeight(weightCfg.getWeightTwo());
}else {
value.setDimensionWeight(weightCfg.getWeightOne());
}
}
weightIndValueService.saveWeightValues(values, weightCfg.getId());
}
}
/**
......
package com.keymobile.indicators.service.weightDataEnter;
import com.keymobile.indicators.model.entity.weight.WeightExcelTemplate;
public interface WeightExcelTemplateService {
WeightExcelTemplate getByWeightId(String weightId);
WeightExcelTemplate getById(Integer id);
void create(WeightExcelTemplate template);
}
package com.keymobile.indicators.service.weightDataEnter;
import com.keymobile.indicators.model.entity.weight.WeightIndValue;
import java.util.List;
public interface WeightIndValueService {
void saveWeightValues(List<WeightIndValue> values, Integer weightId);
List<WeightIndValue> findByWeightId(Integer weightId);
}
package com.keymobile.indicators.service.weightDataEnter.impl;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.dataenter.ExcelIndicator;
import com.keymobile.indicators.model.entity.dataenter.ExcelObj;
import com.keymobile.indicators.model.entity.dataenter.ExcelTemplate;
import com.keymobile.indicators.model.entity.weight.WeightExcelIndicator;
import com.keymobile.indicators.model.entity.weight.WeightExcelObj;
import com.keymobile.indicators.model.entity.weight.WeightExcelTemplate;
import com.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper;
import com.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper;
import com.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper;
import com.keymobile.indicators.service.weightDataEnter.WeightExcelTemplateService;
import com.keymobile.indicators.utils.SystemUserUtil;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* @author DW
* @date 2023-02-23-0023 15:31
* @description
*/
@Service
public class WeightExcelTemplateServiceImpl implements WeightExcelTemplateService {
@Autowired
private WeightExcelIndicatorMapper excelIndicatorMapper;
@Autowired
private WeightExcelObjMapper excelObjMapper;
@Autowired
private WeightExcelTemplateMapper excelTemplateMapper;
@Override
public WeightExcelTemplate getByWeightId(String weightId) {
WeightExcelTemplate template = excelTemplateMapper.getByWeightId(Integer.parseInt(weightId));
if (template != null) {
List<WeightExcelObj> objs = excelObjMapper.getByTempId(template.getId());
List<WeightExcelIndicator> inds = excelIndicatorMapper.getByTempId(template.getId());
template.setObjs(objs);
template.setInds(inds);
}
return template;
}
@Override
public WeightExcelTemplate getById(Integer id) {
WeightExcelTemplate template = excelTemplateMapper.selectByPrimaryKey(id);
if (template != null) {
List<WeightExcelObj> objs = excelObjMapper.getByTempId(id);
List<WeightExcelIndicator> inds = excelIndicatorMapper.getByTempId(id);
template.setObjs(objs);
template.setInds(inds);
}
return template;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(WeightExcelTemplate template) {
// 需要保证weight_data_excel_temp表中weight_id关联的数据唯一
// 先删除(将表数据state修改为3-废弃),再添加
excelTemplateMapper.deleteByWeightId(template.getWeightId());
Date now = new Date();
String currentUserId = SystemUserUtil.getCurrentUserId();
template.setUpdater(currentUserId);
template.setCreator(currentUserId);
template.setUpdateTime(now);
template.setCreateTime(now);
template.setState(Constants.DATA_STATE_A);
excelTemplateMapper.insert(template);
insertIndAndObj(template, now, currentUserId);
}
/**
* 插入指标和对象信息
* @param template
* @param now
* @param currentUserId
*/
private void insertIndAndObj(WeightExcelTemplate template, Date now, String currentUserId) {
List<WeightExcelObj> objs = template.getObjs();
if (CollectionUtils.isNotEmpty(objs)) {
int o = 1;
for (WeightExcelObj obj : objs) {
obj.setId(null);
obj.setTempId(template.getId());
obj.setUpdater(currentUserId);
obj.setCreator(currentUserId);
obj.setUpdateTime(now);
obj.setOrderNum(o++);
obj.setCreateTime(now);
obj.setState(Constants.DATA_STATE_A);
excelObjMapper.insert(obj);
}
}
List<WeightExcelIndicator> inds =template.getInds();
if (CollectionUtils.isNotEmpty(inds)) {
int o = 1;
for (WeightExcelIndicator indicator : inds) {
indicator.setId(null);
indicator.setUpdater(currentUserId);
indicator.setCreator(currentUserId);
indicator.setUpdateTime(now);
indicator.setCreateTime(now);
indicator.setOrderNum(o++);
indicator.setState(Constants.DATA_STATE_A);
indicator.setTempId(template.getId());
indicator.setIndSource(1);
excelIndicatorMapper.insert(indicator);
}
}
}
}
package com.keymobile.indicators.service.weightDataEnter.impl;
import com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg;
import com.keymobile.indicators.model.entity.indicators.DriveIndDef;
import com.keymobile.indicators.model.entity.weight.ObjScoreIndWeightDetail;
import com.keymobile.indicators.model.entity.weight.WeightIndValue;
import com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper;
import com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper;
import com.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper;
import com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper;
import com.keymobile.indicators.service.weightDataEnter.WeightIndValueService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author DW
* @date 2023-02-22-0022 18:13
* @description
*/
@Service
@Slf4j
public class WeightIndValueServiceImpl implements WeightIndValueService {
@Autowired
private WeightIndValueMapper weightIndValueMapper;
@Autowired
private ObjScoreIndWeightDetailMapper weightDetailMapper;
@Autowired
private ObjScoreIndWeightCfgMapper weightCfgMapper;
@Autowired
private DriveIndDefMapper driveIndDefMapper;
@Override
public void saveWeightValues(List<WeightIndValue> values, Integer weightId) {
log.info(weightId + ",正在批量清楚历史数据。。。");
weightIndValueMapper.deleteByWeightId(weightId);
log.info(weightId + ",保存excel数据。。。");
weightIndValueMapper.batchInsert(values);
// 同时将权重结果数据填充到obj_score_ind_weight_detail表中
saveDetail(values, weightId);
}
/**
* 将权重结果数据填充到obj_score_ind_weight_detail表中
* @param values
* @param weightId
*/
private void saveDetail(List<WeightIndValue> values, Integer weightId) {
ObjScoreIndWeightCfg weightCfg = weightCfgMapper.getById(weightId);
// 先清除表里面的数据
weightDetailMapper.deleteByCfgId(weightId);
List<ObjScoreIndWeightDetail> details = new ArrayList<>();
for (WeightIndValue indValue : values) {
DriveIndDef indDef = driveIndDefMapper.selectByPrimaryKey(indValue.getIndId());
ObjScoreIndWeightDetail weightDetail = new ObjScoreIndWeightDetail();
weightDetail.setCfgId(weightId);
weightDetail.setCode(weightCfg.getOrgNo());
weightDetail.setLevelName(weightCfg.getLevelName());
weightDetail.setDataValue(weightCfg.getDateValue());
weightDetail.setOrgNo(indValue.getObjId());
weightDetail.setOrgName(indValue.getObjName());
weightDetail.setIndId(indValue.getIndId());
weightDetail.setIndName(indValue.getIndName());
if (StringUtils.isNotBlank(indDef.getComprehensiveEvaluation())) {
weightDetail.setWeight(new BigDecimal(indDef.getComprehensiveEvaluation()));
}else {
weightDetail.setWeight(new BigDecimal(0));
}
weightDetail.setIndWeight(indValue.getSynthesizeWeight());
weightDetail.setIndImproveWeight(indValue.getImproveWeight());
weightDetail.setWeightTwo(weightCfg.getWeightTwo());
weightDetail.setWeightOne(weightCfg.getWeightOne());
if (weightCfg.getWeightTwo().equals(indValue.getDimensionWeight())) {
weightDetail.setOrgType("两烟区");
}else {
weightDetail.setOrgType("纯销区");
}
weightDetail.setBigWeight(indValue.getDimensionWeight());
details.add(weightDetail);
}
weightDetailMapper.batchInsert(details);
}
@Override
public List<WeightIndValue> findByWeightId(Integer weightId) {
return weightIndValueMapper.findByWeightId(weightId);
}
}
......@@ -25,7 +25,8 @@ public enum ModelPathEnum {
LOG_INDICATOR_CONFIG_INFO("indicator.config.info","系统管理/配置项管理"),
LOG_INDICATOR_LOG("indicator.log","系统管理/操作日志"),
LOG_INDICATOR_AUDIT_ROLE_API("indicator.audit.role","系统管理/填报审核角色配置管理 "),
LOG_INDICATOR_WEIGHTCFG_API("indicator.weightcfg", "数据填报/权重配置");
LOG_INDICATOR_WEIGHTCFG_API("indicator.weightcfg", "数据填报/权重配置"),
LOG_INDICATOR_WEIGHT_DATA_ENTER_API("indicator.weightdataenter", "数据填报/权重配置-数据填报");
private String modelName;
private String modelPath;
......
<?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.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper">
<insert id="batchInsert" parameterType="list">
insert into obj_score_ind_weight_detail
(cfg_id, code, level_name, date_value, org_no, org_name, org_type, ind_id, ind_name, weight, ind_weight, ind_improve_weight,
weight_two, weight_one , big_weight)
values
<foreach collection="valueList" item="val" separator=",">
(#{val.cfgId}, #{val.code}, #{val.levelName}, #{val.dataValue}, #{val.orgNo}, #{val.orgName}, #{val.orgType},
#{val.indId}, #{val.indName}, #{val.weight}, #{val.indWeight}, #{val.indImproveWeight},
#{val.weightTwo}, #{val.weightOne}, #{val.bigWeight})
</foreach>
</insert>
<delete id="deleteByCfgId" parameterType="java.lang.Integer">
delete from obj_score_ind_weight_detail where cfg_id = #{cfgId}
</delete>
</mapper>
\ No newline at end of file
<?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.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper">
<select id="getByTempId" parameterType="java.lang.Integer" resultType="com.keymobile.indicators.model.entity.weight.WeightExcelIndicator" >
select *
from weight_data_excel_ind
where temp_id = #{tempId} and state = 1
order by order_num asc
</select>
<delete id="deleteByTempId" parameterType="java.lang.Integer">
delete
from weight_data_excel_ind
where temp_id = #{tempId}
</delete>
</mapper>
\ No newline at end of file
<?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.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper">
<select id="getByTempId" parameterType="java.lang.Integer" resultType="com.keymobile.indicators.model.entity.weight.WeightExcelObj" >
select *
from weight_data_excel_obj
where temp_id = #{tempId} and state = 1
order by order_num asc
</select>
<delete id="deleteByTempId" parameterType="java.lang.Integer">
delete
from weight_data_excel_obj
where temp_id = #{tempId}
</delete>
</mapper>
\ No newline at end of file
<?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.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper">
<update id="deleteById" parameterType="java.lang.Integer">
update weight_data_excel_temp
set state = 3
where id = #{id}
</update>
<select id="getByWeightId" parameterType="java.lang.Integer" resultType="com.keymobile.indicators.model.entity.weight.WeightExcelTemplate">
select *
from weight_data_excel_temp
where state = 1 and weight_id = #{weightId}
</select>
<update id="deleteByWeightId" parameterType="java.lang.Integer">
update weight_data_excel_temp
set state = 3
where state = 1 and weight_id = #{weightId}
</update>
</mapper>
\ No newline at end of file
<?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.keymobile.indicators.model.mapper.weight.WeightIndValueMapper">
<insert id="batchInsert" parameterType="list">
insert into weight_ind_value
(weight_id, ind_id,ind_name,ind_unit,ind_source, synthesize_weight, improve_weight, dimension_weight, obj_id,obj_name,obj_type,temp_id,
state,creator ,updater,create_time,update_time)
values
<foreach collection="valueList" item="val" separator=",">
(#{val.weightId}, #{val.indId}, #{val.indName}, #{val.indUnit}, #{val.indSource},#{val.synthesizeWeight},#{val.improveWeight},
#{val.dimensionWeight},#{val.objId},#{val.objName},#{val.objType}, #{val.tempId},
#{val.state},#{val.creator},#{val.updater},#{val.createTime}, #{val.updateTime}
)
</foreach>
</insert>
<delete id="batchDelete" parameterType="com.keymobile.indicators.model.entity.weight.WeightIndValue" >
<foreach collection="newValues" item="val" separator=";">
delete from weight_ind_value
where weight_id=#{val.weightId} and ind_id = #{val.indId} and obj_id = #{val.objId}
</foreach>
</delete>
<delete id="deleteByWeightId" parameterType="java.lang.Integer">
delete from weight_ind_value where weight_id = #{weightId}
</delete>
<select id="findByWeightId" parameterType="java.lang.Integer" resultType="com.keymobile.indicators.model.entity.weight.WeightIndValue">
select * from weight_ind_value where weight_id = #{weightId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment