Commit 201c94f9 by zhangkb

修改指标评分卡到mysql库表

parent 8b50a32f
...@@ -114,7 +114,7 @@ public class DriveIndCalculateRegionActor extends AbstractActor{ ...@@ -114,7 +114,7 @@ public class DriveIndCalculateRegionActor extends AbstractActor{
//计算分数 //计算分数
Map<String,String> scoreMap = indScorecardService.calculateIndiScore( Map<String,String> scoreMap = indScorecardService.calculateIndiScore(
driveIndCalResult.getIndId(), driveIndCalResult.getDate(), driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), markType, driveIndCalResult.getCompareObj(), Integer.parseInt(markType),
driveIndCalResult.getCompareId(),compareObjs); driveIndCalResult.getCompareId(),compareObjs);
driveIndCalResult.setScore(scoreMap.get("score")); driveIndCalResult.setScore(scoreMap.get("score"));
driveIndCalResult.setImproveScore(scoreMap.get("improveScore")); driveIndCalResult.setImproveScore(scoreMap.get("improveScore"));
......
...@@ -28,7 +28,7 @@ public class IndCatalogCtrl { ...@@ -28,7 +28,7 @@ public class IndCatalogCtrl {
@ApiOperation(value = "新建基础指标目录", notes = "新建基础指标目录") @ApiOperation(value = "新建基础指标目录", notes = "新建基础指标目录")
@PostMapping(value = "/createBaseIndCatalog") @PostMapping(value = "/createBaseIndCatalog")
public int createBaseIndCatalog(@RequestBody IndCatalog indCatalog) throws Exception{ public Integer createBaseIndCatalog(@RequestBody IndCatalog indCatalog) throws Exception{
indCatalog = indCatalogService.saveOrUpdate(indCatalog); indCatalog = indCatalogService.saveOrUpdate(indCatalog);
return indCatalog.getId(); return indCatalog.getId();
} }
...@@ -49,20 +49,20 @@ public class IndCatalogCtrl { ...@@ -49,20 +49,20 @@ public class IndCatalogCtrl {
//考核指标目录 //考核指标目录
@ApiOperation(value = "新建考核指标目录", notes = "新建考核指标目录") @ApiOperation(value = "新建考核指标目录", notes = "新建考核指标目录")
@PostMapping(value = "/createDriveIndCatalog") @PostMapping(value = "/createDriveIndCatalog")
public String createDriveIndCatalog(@RequestBody DriveIndCatalog driveIndCatalog) throws Exception{ public Integer createDriveIndCatalog(@RequestBody DriveIndCatalog driveIndCatalog) throws Exception{
driveIndCatalog = driveIndCatalogService.saveOrUpdate(driveIndCatalog); driveIndCatalog = driveIndCatalogService.saveOrUpdate(driveIndCatalog);
return driveIndCatalog.getId(); return driveIndCatalog.getId();
} }
@ApiOperation(value = "批量级联删除考核指标目录", notes = "批量级联删除考核指标目录") @ApiOperation(value = "批量级联删除考核指标目录", notes = "批量级联删除考核指标目录")
@PostMapping(value = "/deleteDriveIndCatalog") @PostMapping(value = "/deleteDriveIndCatalog")
public void deleteDriveIndCatalog(@RequestParam List<String> ids) throws Exception{ public void deleteDriveIndCatalog(@RequestParam List<Integer> ids) throws Exception{
driveIndCatalogService.recursionDelete(ids); driveIndCatalogService.recursionDelete(ids);
} }
@ApiOperation(value = "获取考核指标目录", notes = "获取考核指标目录") @ApiOperation(value = "获取考核指标目录", notes = "获取考核指标目录")
@PostMapping(value = "/getDriveIndCatalog") @PostMapping(value = "/getDriveIndCatalog")
public List<DriveIndCatalog> getDriveIndCatalog(@RequestParam(required=false) String parentId, public List<DriveIndCatalog> getDriveIndCatalog(@RequestParam(required=false) Integer parentId,
@RequestParam List<String> codes){ @RequestParam List<String> codes){
return driveIndCatalogService.getCatalog(parentId, codes); return driveIndCatalogService.getCatalog(parentId, codes);
} }
......
...@@ -4,7 +4,6 @@ import java.util.List; ...@@ -4,7 +4,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -30,34 +29,34 @@ public class IndScorecardCtrl { ...@@ -30,34 +29,34 @@ public class IndScorecardCtrl {
@ApiOperation(value = "新增/修改评分卡目录", notes = "新增/修改评分卡目录") @ApiOperation(value = "新增/修改评分卡目录", notes = "新增/修改评分卡目录")
@PostMapping(value = "/saveOrUpdateCatalog") @PostMapping(value = "/saveOrUpdateCatalog")
public String saveOrUpdateCatalog(@RequestBody ScorecardCatalog scorecardCatalog)throws Exception{ public Integer saveOrUpdateCatalog(@RequestBody ScorecardCatalog scorecardCatalog)throws Exception{
scorecardCatalog = scorecardCatalogService.saveOrUpdate(scorecardCatalog); scorecardCatalog = scorecardCatalogService.saveOrUpdate(scorecardCatalog);
return scorecardCatalog.getId(); return scorecardCatalog.getId();
} }
@ApiOperation(value = "批量级联删除评分卡目录", notes = "批量级联删除评分卡目录") @ApiOperation(value = "批量级联删除评分卡目录", notes = "批量级联删除评分卡目录")
@PostMapping(value = "/deleteCatalog") @PostMapping(value = "/deleteCatalog")
public void deleteCatalog(@RequestParam List<String> ids) throws Exception{ public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{
scorecardCatalogService.recursionDelete(ids); scorecardCatalogService.recursionDelete(ids);
} }
@ApiOperation(value = "获取评分卡目录", notes = "获取评分卡目录") @ApiOperation(value = "获取评分卡目录", notes = "获取评分卡目录")
@PostMapping(value = "/getCatalog") @PostMapping(value = "/getCatalog")
public List<ScorecardCatalog> getCatalog(@RequestParam(required=false) String parentId, public List<ScorecardCatalog> getCatalog(@RequestParam(required=false) Integer parentId,
@RequestParam List<String> codes){ @RequestParam List<String> codes){
return scorecardCatalogService.getCatalog(parentId, codes); return scorecardCatalogService.getCatalog(parentId, codes);
} }
@ApiOperation(value = "新增/修改", notes = "新增/修改") @ApiOperation(value = "新增/修改", notes = "新增/修改")
@PostMapping(value = "/saveOrUpdate") @PostMapping(value = "/saveOrUpdate")
public String saveOrUpdate(@RequestBody IndScorecard indScorecard,@RequestParam String catalogId, public Integer saveOrUpdate(@RequestBody IndScorecard indScorecard,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) { @RequestParam String catalogIdPath,@RequestParam String user) {
return indScorecardService.saveOrUpdate(indScorecard,catalogId,catalogIdPath,user); return indScorecardService.saveOrUpdate(indScorecard,catalogId,catalogIdPath,user);
} }
@ApiOperation(value = "删除", notes = "删除") @ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public void delete(@RequestBody List<String> ids) { public void delete(@RequestBody List<Integer> ids) {
indScorecardService.delete(ids); indScorecardService.delete(ids);
} }
...@@ -69,7 +68,7 @@ public class IndScorecardCtrl { ...@@ -69,7 +68,7 @@ public class IndScorecardCtrl {
@ApiOperation(value = "根据评分卡目录获取评分卡", notes = "根据评分卡目录获取评分卡") @ApiOperation(value = "根据评分卡目录获取评分卡", notes = "根据评分卡目录获取评分卡")
@PostMapping(value = "/getByCatalogId") @PostMapping(value = "/getByCatalogId")
public Page<IndScorecard> getByCatalogId(@RequestParam String catalogId, public Map<String,Object> getByCatalogId(@RequestParam Integer catalogId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "rows", required = false, defaultValue = "10") int rows){ @RequestParam(value = "rows", required = false, defaultValue = "10") int rows){
return indScorecardService.getByCatalogId(catalogId,page,rows); return indScorecardService.getByCatalogId(catalogId,page,rows);
...@@ -77,14 +76,14 @@ public class IndScorecardCtrl { ...@@ -77,14 +76,14 @@ public class IndScorecardCtrl {
@ApiOperation(value = "根据id获取评分卡", notes = "根据id获取评分卡") @ApiOperation(value = "根据id获取评分卡", notes = "根据id获取评分卡")
@PostMapping(value = "/findById") @PostMapping(value = "/findById")
public IndScorecard findById(@RequestParam String id) { public IndScorecard findById(@RequestParam Integer id) {
return indScorecardService.findById(id); return indScorecardService.findById(id);
} }
@ApiOperation(value = "根据评分卡计算指标分数", notes = "根据评分卡计算指标分数") @ApiOperation(value = "根据评分卡计算指标分数", notes = "根据评分卡计算指标分数")
@PostMapping(value = "/calculateIndiScore") @PostMapping(value = "/calculateIndiScore")
public Map<String,String> calculateIndiScore(@RequestParam String indId,@RequestParam int date, public Map<String,String> calculateIndiScore(@RequestParam String indId,@RequestParam int date,
@RequestParam String compareObj,@RequestParam String indScorecardId, @RequestParam String compareObj,@RequestParam Integer indScorecardId,
@RequestParam String compareId,@RequestBody List<String> compareObjs) throws Exception{ @RequestParam String compareId,@RequestBody List<String> compareObjs) throws Exception{
return indScorecardService.calculateIndiScore(indId, date, compareObj, return indScorecardService.calculateIndiScore(indId, date, compareObj,
indScorecardId,compareId,compareObjs); indScorecardId,compareId,compareObjs);
......
...@@ -2,6 +2,8 @@ package com.keymobile.indicators.model.entity.indicators; ...@@ -2,6 +2,8 @@ package com.keymobile.indicators.model.entity.indicators;
import java.util.Date; import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -16,6 +18,7 @@ import lombok.Data; ...@@ -16,6 +18,7 @@ import lombok.Data;
@Table(name="drive_ind_cal_result_def") @Table(name="drive_ind_cal_result_def")
public class DriveIndCalResultDef { public class DriveIndCalResultDef {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String compareId; private String compareId;
......
package com.keymobile.indicators.model.entity.indicators; package com.keymobile.indicators.model.entity.indicators;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import org.springframework.data.annotation.Id; import javax.persistence.GeneratedValue;
import org.springframework.data.mongodb.core.mapping.Document; import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.keymobile.indicators.utils.DateUtils; import com.keymobile.indicators.utils.DateUtils;
...@@ -14,19 +15,15 @@ import lombok.Data; ...@@ -14,19 +15,15 @@ import lombok.Data;
*author:zhangkb time:2020-5-18 desc:考核指标目录 *author:zhangkb time:2020-5-18 desc:考核指标目录
*/ */
@Data @Data
@Document(collection="drive_ind_catalog") @Table(name="drive_ind_catalog")
public class DriveIndCatalog implements Serializable{ public class DriveIndCatalog {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id @Id
private String id; @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String catalogName; private String catalogName;
//private String type; //private String type;
private String catalogType;//分为数据项级别和数据项类别 0:数据项级别 1:数据项类别 2:普通目录 private String catalogType;//分为数据项级别和数据项类别 0:数据项级别 1:数据项类别 2:普通目录
private String parentId;//顶层节点parentId为0 private Integer parentId;//顶层节点parentId为0
private String idPath; private String idPath;
private String code;//目录编码 private String code;//目录编码
private String lastUpdater; private String lastUpdater;
......
...@@ -2,6 +2,8 @@ package com.keymobile.indicators.model.entity.indicators; ...@@ -2,6 +2,8 @@ package com.keymobile.indicators.model.entity.indicators;
import java.util.Date; import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -16,6 +18,7 @@ import lombok.Data; ...@@ -16,6 +18,7 @@ import lombok.Data;
@Table(name="base_ind_catalog") @Table(name="base_ind_catalog")
public class IndCatalog { public class IndCatalog {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String catalogName; private String catalogName;
//private String type; //private String type;
......
package com.keymobile.indicators.model.entity.indicators; package com.keymobile.indicators.model.entity.indicators;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -12,6 +14,7 @@ import lombok.Data; ...@@ -12,6 +14,7 @@ import lombok.Data;
@Table(name="indi_data_def") @Table(name="indi_data_def")
public class IndicatorsData { public class IndicatorsData {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String indId; private String indId;
......
package com.keymobile.indicators.model.entity.scorecard; package com.keymobile.indicators.model.entity.scorecard;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.data.annotation.Id; import javax.persistence.GeneratedValue;
import org.springframework.data.mongodb.core.mapping.Document; import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.keymobile.indicators.utils.DateUtils; import com.keymobile.indicators.utils.DateUtils;
import lombok.Data; import lombok.Data;
...@@ -16,48 +16,40 @@ import lombok.Data; ...@@ -16,48 +16,40 @@ import lombok.Data;
*author:zhangkb time:2020-5-6 desc:考核指标评分卡 *author:zhangkb time:2020-5-6 desc:考核指标评分卡
*/ */
@Data @Data
@Document(collection="drive_ind_score_card") @Table(name ="drive_ind_score_card")
public class IndScorecard implements Serializable{ public class IndScorecard {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id @Id
private String id; @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String cardName; private String cardName;
private String desc; private String cardDesc;
private String scoreType;//综合评分类型 0:定义 1:公式 private String scoreType;//综合评分类型 0:定义 1:公式
//定义综合评价 //定义综合评价
private double indBaseScore;//基础分 private Double indBaseScore;//基础分
private double moreAverage;//大于组内平均分加分 private Double moreAverage;//大于组内平均分加分
private double lessAverage;//小于组内平均分减分 private Double lessAverage;//小于组内平均分减分
private String addScoreItemJson;//加分项json
private String minusScoreItemJson;//减分项json
private List<RankScoreDef> addScoreItem = new ArrayList<>();//加分项 private List<RankScoreDef> addScoreItem = new ArrayList<>();//加分项
private List<RankScoreDef> minusScoreItem = new ArrayList<>();//减分项 private List<RankScoreDef> minusScoreItem = new ArrayList<>();//减分项
//公式综合评价 //公式综合评价
private double bestIndScore;//最佳指标分 private Double bestIndScore;//最佳指标分
private double worstIndScore;//最差指标分 private Double worstIndScore;//最差指标分
private String otherCalFormula;//其他计算公式 private String otherCalFormula;//其他计算公式
//改善提升 //改善提升
private String isIncluScore;//是否纳入单位计分 0:不纳入 1:纳入 private String isIncluScore;//是否纳入单位计分 0:不纳入 1:纳入
private double limitScore;//上限分数 private Double limitScore;//上限分数
private String improveScoreItemJson;//改善提升分数json
private List<ImproveScoreDef> improveScoreItem = new ArrayList<>();//改善提升分数 private List<ImproveScoreDef> improveScoreItem = new ArrayList<>();//改善提升分数
private String catalogId;//评分卡目录id private Integer catalogId;//评分卡目录id
private String catalogIdPath;//评分卡目录idPath private String catalogIdPath;//评分卡目录idPath
private String lastUpdateTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"); private String lastUpdateTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
private String lastUpdater; private String lastUpdater;
public void setAddScoreItem(List<RankScoreDef> addScoreItem) {
this.addScoreItem.addAll(addScoreItem);
}
public void setMinusScoreItem(List<RankScoreDef> minusScoreItem) {
this.minusScoreItem.addAll(minusScoreItem);
}
public void setImproveScoreItem(List<ImproveScoreDef> improveScoreItem) {
this.improveScoreItem.addAll(improveScoreItem);
}
} }
package com.keymobile.indicators.model.entity.scorecard; package com.keymobile.indicators.model.entity.scorecard;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import org.springframework.data.annotation.Id; import javax.persistence.GeneratedValue;
import org.springframework.data.mongodb.core.mapping.Document; import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.keymobile.indicators.utils.DateUtils; import com.keymobile.indicators.utils.DateUtils;
import lombok.Data; import lombok.Data;
...@@ -14,18 +14,14 @@ import lombok.Data; ...@@ -14,18 +14,14 @@ import lombok.Data;
*author:zhangkb time:2020-6-9 desc:指标评分卡目录实体 *author:zhangkb time:2020-6-9 desc:指标评分卡目录实体
*/ */
@Data @Data
@Document(collection="score_card_catalog") @Table(name="score_card_catalog")
public class ScorecardCatalog implements Serializable{ public class ScorecardCatalog{
/**
*
*/
private static final long serialVersionUID = 1L;
@Id @Id
private String id; @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String catalogName; private String catalogName;
private String catalogType; private String catalogType;
private String parentId;//顶层节点parentId为0 private Integer parentId;//顶层节点parentId为0
private String idPath; private String idPath;
private String code;//目录编码 private String code;//目录编码
private String lastUpdater; private String lastUpdater;
......
...@@ -15,5 +15,5 @@ public interface DriveIndDefMapper extends BaseMapper<DriveIndDef>{ ...@@ -15,5 +15,5 @@ public interface DriveIndDefMapper extends BaseMapper<DriveIndDef>{
public int getByKeywordCount(Map<String,Object> param); public int getByKeywordCount(Map<String,Object> param);
public void deleteByCatalogIdIn(List<String> catalogIds); public void deleteByCatalogIdIn(List<Integer> catalogIds);
} }
package com.keymobile.indicators.model.mapper.indmapper;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog;
import feign.Param;
import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface DriveIndCatalogMapper extends BaseMapper<DriveIndCatalog>{
public void deleteByIdIn(List<Integer> ids);
public List<DriveIndCatalog> findByParentIdAndCodeInOrderByLastUpdateTimeDesc(Map<String,Object> params);
public List<DriveIndCatalog> findByParentId(@Param("pid") Integer pid);
}
package com.keymobile.indicators.model.mapper.indmapper; package com.keymobile.indicators.model.mapper.indmapper;
import org.apache.ibatis.annotations.Mapper;
import com.keymobile.indicators.model.entity.indicators.DriveIndDefVersionData; import com.keymobile.indicators.model.entity.indicators.DriveIndDefVersionData;
import tk.mybatis.mapper.common.BaseMapper; import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface DriveIndDefVersionDataMapper extends BaseMapper<DriveIndDefVersionData>{ public interface DriveIndDefVersionDataMapper extends BaseMapper<DriveIndDefVersionData>{
} }
...@@ -3,11 +3,13 @@ package com.keymobile.indicators.model.mapper.indmapper; ...@@ -3,11 +3,13 @@ package com.keymobile.indicators.model.mapper.indmapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import com.keymobile.indicators.model.entity.indicators.IndCatalog; import com.keymobile.indicators.model.entity.indicators.IndCatalog;
import feign.Param; import feign.Param;
import tk.mybatis.mapper.common.BaseMapper; import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface IndCatalogMapper extends BaseMapper<IndCatalog>{ public interface IndCatalogMapper extends BaseMapper<IndCatalog>{
public void deleteByIdIn(List<Integer> ids); public void deleteByIdIn(List<Integer> ids);
......
package com.keymobile.indicators.model.mapper.indmapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.keymobile.indicators.model.entity.scorecard.IndScorecard;
import feign.Param;
import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface IndScorecardMapper extends BaseMapper<IndScorecard>{
public void deleteByCatalogIdIn(List<Integer> catalogIds);
public List<IndScorecard> findByCatalogId(@Param("catalogId")Integer catalogId,
@Param("start") int start,@Param("end") int end);
public int countByCatalogId(@Param("catalogId")Integer catalogId);
}
package com.keymobile.indicators.model.mapper.indmapper;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog;
import feign.Param;
import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface ScorecardCatalogMapper extends BaseMapper<ScorecardCatalog>{
public void deleteByIdIn(List<Integer> ids);
public List<ScorecardCatalog> findByParentIdAndCodeInOrderByLastUpdateTimeDesc(Map<String,Object> params);
public List<ScorecardCatalog> findByParentId(@Param("pid") Integer pid);
}
package com.keymobile.indicators.persistence.hyindicators;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog;
public interface DriveIndCatalogRepository extends MongoRepository<DriveIndCatalog,String>{
public void deleteByIdIn(List<String> ids);
public List<DriveIndCatalog> findByParentIdAndCodeInOrderByLastUpdateTimeDesc(String pid,List<String> codes);
public List<DriveIndCatalog> findByParentId(String pid);
}
package com.keymobile.indicators.persistence.hyindicators;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.keymobile.indicators.model.entity.scorecard.IndScorecard;
public interface IndScorecardRepository extends MongoRepository<IndScorecard,String>{
public void deleteByCatalogIdIn(List<String> catalogIds);
public Page<IndScorecard> findByCatalogId(String catalogId,Pageable page);
}
package com.keymobile.indicators.persistence.hyindicators;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog;
public interface ScorecardCatalogRepository extends MongoRepository<ScorecardCatalog,String>{
public void deleteByIdIn(List<String> ids);
public List<ScorecardCatalog> findByParentIdAndCodeInOrderByLastUpdateTimeDesc(String pid,List<String> codes);
public List<ScorecardCatalog> findByParentId(String pid);
}
...@@ -30,9 +30,7 @@ public class DriveIndCalResultService { ...@@ -30,9 +30,7 @@ public class DriveIndCalResultService {
} }
public DriveIndCalResultDef findById(Integer id) { public DriveIndCalResultDef findById(Integer id) {
DriveIndCalResultDef driveCalResultDef = new DriveIndCalResultDef(); return driveIndCalResultDefMapper.selectByPrimaryKey(id);
driveCalResultDef.setId(id);
return driveIndCalResultDefMapper.selectOne(driveCalResultDef);
} }
public DriveIndCalResultDef findCompareObjInfo(String driveIndId,int date,String compareObj) { public DriveIndCalResultDef findCompareObjInfo(String driveIndId,int date,String compareObj) {
......
package com.keymobile.indicators.service.hytobacco; package com.keymobile.indicators.service.hytobacco;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,50 +11,50 @@ import org.springframework.stereotype.Service; ...@@ -12,50 +11,50 @@ import org.springframework.stereotype.Service;
import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog; import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog;
import com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper; import com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper;
import com.keymobile.indicators.persistence.hyindicators.DriveIndCatalogRepository; import com.keymobile.indicators.model.mapper.indmapper.DriveIndCatalogMapper;
@Service @Service
public class DriveIndCatalogService { public class DriveIndCatalogService {
private Logger logger = LoggerFactory.getLogger(DriveIndCatalogService.class); private Logger logger = LoggerFactory.getLogger(DriveIndCatalogService.class);
@Autowired @Autowired
private DriveIndCatalogRepository driveIndCatalogRepo; private DriveIndCatalogMapper driveIndCatalogMapper;
@Autowired @Autowired
private DriveIndDefMapper driveIndDefMapper; private DriveIndDefMapper driveIndDefMapper;
public DriveIndCatalog saveOrUpdate(DriveIndCatalog driveIndCatalog) throws Exception{ public DriveIndCatalog saveOrUpdate(DriveIndCatalog driveIndCatalog) throws Exception{
if(StringUtils.isBlank(driveIndCatalog.getId())) {//新增 if(driveIndCatalog.getId()==null) {//新增
//保存 //保存
driveIndCatalog = driveIndCatalogRepo.save(driveIndCatalog); driveIndCatalogMapper.insert(driveIndCatalog);
} }
//获取parentId拼接idPath //获取parentId拼接idPath
String parentId = driveIndCatalog.getParentId(); Integer parentId = driveIndCatalog.getParentId();
if(StringUtils.isBlank(parentId) || "0".equals(parentId)) {//顶层节点 if(parentId==0) {//顶层节点
driveIndCatalog.setIdPath(driveIndCatalog.getId()); driveIndCatalog.setIdPath(String.valueOf(driveIndCatalog.getId()));
}else { }else {
Optional<DriveIndCatalog> parentDriveIndCatalog = driveIndCatalogRepo.findById(driveIndCatalog.getParentId()); DriveIndCatalog parentDriveIndCatalog = driveIndCatalogMapper.selectByPrimaryKey(driveIndCatalog.getParentId());
if(!parentDriveIndCatalog.isPresent()) { if(parentDriveIndCatalog==null) {
throw new Exception("父节点不存在:parent catalog is not exist"); throw new Exception("父节点不存在:parent catalog is not exist");
}else { }else {
driveIndCatalog.setIdPath(parentDriveIndCatalog.get().getIdPath()+";"+ driveIndCatalog.setIdPath(parentDriveIndCatalog.getIdPath()+";"+
driveIndCatalog.getId()); driveIndCatalog.getId());
} }
} }
//保存 //保存
driveIndCatalog = driveIndCatalogRepo.save(driveIndCatalog); driveIndCatalogMapper.updateByPrimaryKey(driveIndCatalog);
return driveIndCatalog; return driveIndCatalog;
} }
public void delete(List<String> ids) { public void delete(List<Integer> ids) {
driveIndCatalogRepo.deleteByIdIn(ids); driveIndCatalogMapper.deleteByIdIn(ids);
} }
//递归查找父目录下的子目录 //递归查找父目录下的子目录
public List<String> getDeleteCatalogId(String id){ public List<Integer> getDeleteCatalogId(Integer id){
List<String> result = new ArrayList<>(); List<Integer> result = new ArrayList<>();
result.add(id); result.add(id);
//根据id获取子节点 //根据id获取子节点
List<DriveIndCatalog> children = driveIndCatalogRepo.findByParentId(id); List<DriveIndCatalog> children = driveIndCatalogMapper.findByParentId(id);
if(!children.isEmpty()) { if(!children.isEmpty()) {
for(DriveIndCatalog child : children) { for(DriveIndCatalog child : children) {
result.addAll(getDeleteCatalogId(child.getId())); result.addAll(getDeleteCatalogId(child.getId()));
...@@ -65,9 +64,9 @@ public class DriveIndCatalogService { ...@@ -65,9 +64,9 @@ public class DriveIndCatalogService {
} }
//递归删除 //递归删除
public void recursionDelete(List<String> ids) { public void recursionDelete(List<Integer> ids) {
for(String id : ids) { for(Integer id : ids) {
List<String> result = this.getDeleteCatalogId(id); List<Integer> result = this.getDeleteCatalogId(id);
this.delete(result); this.delete(result);
//删除目录关联的指标 //删除目录关联的指标
driveIndDefMapper.deleteByCatalogIdIn(result); driveIndDefMapper.deleteByCatalogIdIn(result);
...@@ -75,10 +74,10 @@ public class DriveIndCatalogService { ...@@ -75,10 +74,10 @@ public class DriveIndCatalogService {
} }
//获取目录树 //获取目录树
public List<DriveIndCatalog> getCatalog(String parentId,List<String> codes){ public List<DriveIndCatalog> getCatalog(Integer parentId,List<String> codes){
if(StringUtils.isBlank(parentId) || "0".equals(parentId)) { Map<String,Object> paramMap = new HashMap<>();
return driveIndCatalogRepo.findByParentIdAndCodeInOrderByLastUpdateTimeDesc("0", codes); paramMap.put("pid", parentId);
} paramMap.put("codes", codes);
return driveIndCatalogRepo.findByParentIdAndCodeInOrderByLastUpdateTimeDesc(parentId, codes); return driveIndCatalogMapper.findByParentIdAndCodeInOrderByLastUpdateTimeDesc(paramMap);
} }
} }
...@@ -4,9 +4,6 @@ import java.util.ArrayList; ...@@ -4,9 +4,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,7 +23,7 @@ public class IndCatalogService { ...@@ -26,7 +23,7 @@ public class IndCatalogService {
private BaseIndDefMapper baseIndDefMapper; private BaseIndDefMapper baseIndDefMapper;
public IndCatalog saveOrUpdate(IndCatalog indCatalog) throws Exception{ public IndCatalog saveOrUpdate(IndCatalog indCatalog) throws Exception{
if(indCatalog.getId()!=null) {//新增 if(indCatalog.getId()==null) {//新增
//保存 //保存
indCatalogMapper.insert(indCatalog); indCatalogMapper.insert(indCatalog);
} }
...@@ -35,9 +32,7 @@ public class IndCatalogService { ...@@ -35,9 +32,7 @@ public class IndCatalogService {
if(parentId==0) {//顶层节点 if(parentId==0) {//顶层节点
indCatalog.setIdPath(String.valueOf(indCatalog.getId())); indCatalog.setIdPath(String.valueOf(indCatalog.getId()));
}else { }else {
IndCatalog findIndCatalog = new IndCatalog(); IndCatalog parentIndCatalog = indCatalogMapper.selectByPrimaryKey(indCatalog.getParentId());
findIndCatalog.setId(indCatalog.getParentId());
IndCatalog parentIndCatalog = indCatalogMapper.selectOne(findIndCatalog);
if(parentIndCatalog==null) { if(parentIndCatalog==null) {
throw new Exception("父节点不存在:parent catalog is not exist"); throw new Exception("父节点不存在:parent catalog is not exist");
}else { }else {
...@@ -45,7 +40,7 @@ public class IndCatalogService { ...@@ -45,7 +40,7 @@ public class IndCatalogService {
} }
} }
//保存 //保存
indCatalogMapper.insert(indCatalog); indCatalogMapper.updateByPrimaryKey(indCatalog);
return indCatalog; return indCatalog;
} }
......
...@@ -5,18 +5,15 @@ import java.util.HashMap; ...@@ -5,18 +5,15 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.googlecode.aviator.AviatorEvaluator; import com.googlecode.aviator.AviatorEvaluator;
import com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef; import com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef;
import com.keymobile.indicators.model.entity.indicators.DriveIndDef; import com.keymobile.indicators.model.entity.indicators.DriveIndDef;
...@@ -24,7 +21,7 @@ import com.keymobile.indicators.model.entity.scorecard.ImproveScoreDef; ...@@ -24,7 +21,7 @@ import com.keymobile.indicators.model.entity.scorecard.ImproveScoreDef;
import com.keymobile.indicators.model.entity.scorecard.IndScorecard; import com.keymobile.indicators.model.entity.scorecard.IndScorecard;
import com.keymobile.indicators.model.entity.scorecard.RankScoreDef; import com.keymobile.indicators.model.entity.scorecard.RankScoreDef;
import com.keymobile.indicators.model.mapper.indmapper.DriveIndCalResultDefMapper; import com.keymobile.indicators.model.mapper.indmapper.DriveIndCalResultDefMapper;
import com.keymobile.indicators.persistence.hyindicators.IndScorecardRepository; import com.keymobile.indicators.model.mapper.indmapper.IndScorecardMapper;
import com.keymobile.indicators.utils.CalculateUtils; import com.keymobile.indicators.utils.CalculateUtils;
@Service @Service
...@@ -32,54 +29,74 @@ public class IndScorecardService { ...@@ -32,54 +29,74 @@ public class IndScorecardService {
private Logger logger = LoggerFactory.getLogger(IndScorecardService.class); private Logger logger = LoggerFactory.getLogger(IndScorecardService.class);
@Autowired @Autowired
private IndScorecardRepository indScorecardRepo; private IndScorecardMapper indScorecardMapper;
@Autowired @Autowired
private DriveIndDefService driveIndDefService; private DriveIndDefService driveIndDefService;
@Autowired @Autowired
private DriveIndCalResultDefMapper driveIndCalResultDefMapper; private DriveIndCalResultDefMapper driveIndCalResultDefMapper;
//id不为空为修改,为空为新增 //id不为空为修改,为空为新增
public String saveOrUpdate(IndScorecard indScorecard,String catalogId, public Integer saveOrUpdate(IndScorecard indScorecard,Integer catalogId,
String catalogIdPath,String user) { String catalogIdPath,String user) {
Gson gson = new Gson();
if(!indScorecard.getAddScoreItem().isEmpty()) {
String addScoreItemJson = gson.toJson(indScorecard.getAddScoreItem());
indScorecard.setAddScoreItemJson(addScoreItemJson);
}
if(!indScorecard.getMinusScoreItem().isEmpty()) {
String minusScoreItemJson = gson.toJson(indScorecard.getMinusScoreItem());
indScorecard.setMinusScoreItemJson(minusScoreItemJson);
}
if(!indScorecard.getImproveScoreItem().isEmpty()) {
String improveScoreItemJson = gson.toJson(indScorecard.getImproveScoreItem());
indScorecard.setImproveScoreItemJson(improveScoreItemJson);
}
indScorecard.setCatalogId(catalogId); indScorecard.setCatalogId(catalogId);
indScorecard.setCatalogIdPath(catalogIdPath); indScorecard.setCatalogIdPath(catalogIdPath);
indScorecard.setLastUpdater(user); indScorecard.setLastUpdater(user);
indScorecard = indScorecardRepo.save(indScorecard); indScorecardMapper.insert(indScorecard);
return indScorecard.getId(); return indScorecard.getId();
} }
public void delete(List<String> ids) { public void delete(List<Integer> ids) {
for(String id : ids) { for(Integer id : ids) {
indScorecardRepo.deleteById(id); indScorecardMapper.deleteByPrimaryKey(id);
} }
} }
public List<IndScorecard> getAll(){ public List<IndScorecard> getAll(){
return indScorecardRepo.findAll(); return indScorecardMapper.selectAll();
} }
public IndScorecard findById(String id) { public IndScorecard findById(Integer id) {
Optional<IndScorecard> result = indScorecardRepo.findById(id); IndScorecard result = indScorecardMapper.selectByPrimaryKey(id);
if(result.isPresent()) { if(result!=null) {
return result.get(); return result;
} }
return null; return null;
} }
public Page<IndScorecard> getByCatalogId(String catalogId,int page,int rows){ public Map<String,Object> getByCatalogId(Integer catalogId,int page,int rows){
Pageable pageable = PageRequest.of(page - 1, rows); Map<String,Object> result = new HashMap<>();
return indScorecardRepo.findByCatalogId(catalogId,pageable); int count = 0;
//计算start
int start = (page-1)*rows;
count = indScorecardMapper.countByCatalogId(catalogId);
List<IndScorecard> datas = indScorecardMapper.findByCatalogId(catalogId,start,rows);
result.put("count", count);
result.put("data", datas);
return result;
} }
public Map<String,String> calculateIndiScore(String indId,int date,String compareObj, public Map<String,String> calculateIndiScore(String indId,int date,String compareObj,
String indScorecardId,String compareId,List<String> compareObjs) throws Exception{ Integer indScorecardId,String compareId,List<String> compareObjs) throws Exception{
Map<String,String> result = new HashMap<>(); Map<String,String> result = new HashMap<>();
String indScoreValue = "0.0"; String indScoreValue = "0.0";
String indImproveScoreValue = "0.0"; String indImproveScoreValue = "0.0";
result.put("score",indScoreValue); result.put("score",indScoreValue);
result.put("improveScore",indImproveScoreValue); result.put("improveScore",indImproveScoreValue);
if(StringUtils.isNotBlank(indScorecardId)) { if(indScorecardId!=null) {
//根据评分卡id获取评分卡信息 //根据评分卡id获取评分卡信息
IndScorecard scoreCard = this.findById(indScorecardId); IndScorecard scoreCard = this.findById(indScorecardId);
double baseScoreValue = 0; double baseScoreValue = 0;
......
package com.keymobile.indicators.service.hytobacco; package com.keymobile.indicators.service.hytobacco;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog; import com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog;
import com.keymobile.indicators.persistence.hyindicators.IndScorecardRepository; import com.keymobile.indicators.model.mapper.indmapper.IndScorecardMapper;
import com.keymobile.indicators.persistence.hyindicators.ScorecardCatalogRepository; import com.keymobile.indicators.model.mapper.indmapper.ScorecardCatalogMapper;
@Service @Service
public class ScorecardCatalogService { public class ScorecardCatalogService {
private Logger logger = LoggerFactory.getLogger(ScorecardCatalogService.class); private Logger logger = LoggerFactory.getLogger(ScorecardCatalogService.class);
@Autowired @Autowired
private ScorecardCatalogRepository scorecardCatalogRepo; private ScorecardCatalogMapper scorecardCatalogMapper;
@Autowired @Autowired
private IndScorecardRepository indScorecardRepo; private IndScorecardMapper indScorecardMapper;
public ScorecardCatalog saveOrUpdate(ScorecardCatalog scorecardCatalog) throws Exception{ public ScorecardCatalog saveOrUpdate(ScorecardCatalog scorecardCatalog) throws Exception{
if(StringUtils.isBlank(scorecardCatalog.getId())) {//新增 if(scorecardCatalog.getId()==null) {//新增
//保存 //保存
scorecardCatalog = scorecardCatalogRepo.save(scorecardCatalog); scorecardCatalogMapper.insert(scorecardCatalog);
} }
//获取parentId拼接idPath //获取parentId拼接idPath
String parentId = scorecardCatalog.getParentId(); Integer parentId = scorecardCatalog.getParentId();
if(StringUtils.isBlank(parentId) || "0".equals(parentId)) {//顶层节点 if(parentId==0) {//顶层节点
scorecardCatalog.setIdPath(scorecardCatalog.getId()); scorecardCatalog.setIdPath(String.valueOf(scorecardCatalog.getId()));
}else { }else {
Optional<ScorecardCatalog> parentScorecardCatalog = scorecardCatalogRepo. ScorecardCatalog parentScorecardCatalog = scorecardCatalogMapper.
findById(scorecardCatalog.getParentId()); selectByPrimaryKey(scorecardCatalog.getParentId());
if(!parentScorecardCatalog.isPresent()) { if(parentScorecardCatalog==null) {
throw new Exception("父节点不存在:parent catalog is not exist"); throw new Exception("父节点不存在:parent catalog is not exist");
}else { }else {
scorecardCatalog.setIdPath(parentScorecardCatalog.get().getIdPath()+";"+scorecardCatalog.getId()); scorecardCatalog.setIdPath(parentScorecardCatalog.getIdPath()+";"+scorecardCatalog.getId());
} }
} }
//保存 //保存
scorecardCatalog = scorecardCatalogRepo.save(scorecardCatalog); scorecardCatalogMapper.updateByPrimaryKey(scorecardCatalog);
return scorecardCatalog; return scorecardCatalog;
} }
public void delete(List<String> ids) { public void delete(List<Integer> ids) {
scorecardCatalogRepo.deleteByIdIn(ids); scorecardCatalogMapper.deleteByIdIn(ids);
} }
//递归查找父目录下的子目录 //递归查找父目录下的子目录
public List<String> getDeleteCatalogId(String id){ public List<Integer> getDeleteCatalogId(Integer id){
List<String> result = new ArrayList<>(); List<Integer> result = new ArrayList<>();
result.add(id); result.add(id);
//根据id获取子节点 //根据id获取子节点
List<ScorecardCatalog> children = scorecardCatalogRepo.findByParentId(id); List<ScorecardCatalog> children = scorecardCatalogMapper.findByParentId(id);
if(!children.isEmpty()) { if(!children.isEmpty()) {
for(ScorecardCatalog child : children) { for(ScorecardCatalog child : children) {
result.addAll(getDeleteCatalogId(child.getId())); result.addAll(getDeleteCatalogId(child.getId()));
...@@ -65,20 +65,20 @@ public class ScorecardCatalogService { ...@@ -65,20 +65,20 @@ public class ScorecardCatalogService {
} }
//递归删除 //递归删除
public void recursionDelete(List<String> ids) { public void recursionDelete(List<Integer> ids) {
for(String id : ids) { for(Integer id : ids) {
List<String> result = this.getDeleteCatalogId(id); List<Integer> result = this.getDeleteCatalogId(id);
this.delete(result); this.delete(result);
//删除目录关联的评分卡 //删除目录关联的评分卡
indScorecardRepo.deleteByCatalogIdIn(result); indScorecardMapper.deleteByCatalogIdIn(result);
} }
} }
//获取目录树 //获取目录树
public List<ScorecardCatalog> getCatalog(String parentId,List<String> codes){ public List<ScorecardCatalog> getCatalog(Integer parentId,List<String> codes){
if(StringUtils.isBlank(parentId) || "0".equals(parentId)) { Map<String,Object> paramMap = new HashMap<>();
return scorecardCatalogRepo.findByParentIdAndCodeInOrderByLastUpdateTimeDesc("0", codes); paramMap.put("pid", parentId);
} paramMap.put("codes", codes);
return scorecardCatalogRepo.findByParentIdAndCodeInOrderByLastUpdateTimeDesc(parentId, codes); return scorecardCatalogMapper.findByParentIdAndCodeInOrderByLastUpdateTimeDesc(paramMap);
} }
} }
<?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.indmapper.DriveIndCatalogMapper">
<delete id="deleteByIdIn" parameterType="java.util.List">
delete
from drive_ind_catalog
where id in
<foreach item="id" collection="ids" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
<select id="findByParentIdAndCodeInOrderByLastUpdateTimeDesc" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCatalog" >
select *
from drive_ind_catalog
where parent_id = #{pid} and
code in
<foreach item="id" collection="codes" open="(" close=")" separator=",">
#{id}
</foreach>
order by last_update_time desc
</select>
<select id="findByParentId" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCatalog" >
select *
from drive_ind_catalog
where parent_id = #{pid}
</select>
</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.indmapper.IndScorecardMapper">
<select id="findByCatalogId" resultType="com.keymobile.indicators.model.entity.scorecard.IndScorecard" >
select *
from drive_ind_score_card
where catalog_id = #{catalogId}
limit #{start},#{end}
</select>
<select id="countByCatalogId" resultType="java.lang.Integer">
select count(1)
from drive_ind_score_card
where catalog_id = #{catalogId}
</select>
<delete id="deleteByCatalogIdIn" parameterType="java.util.List">
delete
from drive_ind_score_card
where catalog_id in
<foreach item="id" collection="catalogIds" open="(" close=")" separator=",">
#{id}
</foreach>
</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.indmapper.ScorecardCatalogMapper">
<delete id="deleteByIdIn" parameterType="java.util.List">
delete
from score_card_catalog
where id in
<foreach item="id" collection="ids" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
<select id="findByParentIdAndCodeInOrderByLastUpdateTimeDesc" parameterType="map" resultType="com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog" >
select *
from score_card_catalog
where parent_id = #{pid} and
code in
<foreach item="id" collection="codes" open="(" close=")" separator=",">
#{id}
</foreach>
order by last_update_time desc
</select>
<select id="findByParentId" resultType="com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog" >
select *
from score_card_catalog
where parent_id = #{pid}
</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