Merge branch 'develop_master' into 'FOTON'

Develop master

See merge request LiuChao/foton-slrs-system-rest!278
This commit is contained in:
王夏晖
2021-12-09 19:37:15 +08:00
27 changed files with 367 additions and 90 deletions
@@ -74,6 +74,10 @@ public class WebMvcConfig implements WebMvcConfigurer {
//企业标准导出
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/exportSarBussionessStand");
//预警导出
addInterceptor.excludePathPatterns("/api/sys/EarlyWarning/exportWarning");
//OCR回调存储文件
addInterceptor.excludePathPatterns("/api/ocr/OCRRestful/OcrHandleResult");
@@ -94,7 +98,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
// 添加自定义拦截器,并拦截对应 url
addInterceptor.addPathPatterns("/**");
// // 添加自定义拦截器,并拦截对应 url
// addInterceptor.addPathPatterns("/**");
}
}
@@ -71,16 +71,17 @@ public class QualityEvaluationController extends BaseController<QualityEvaluatio
@ApiOperation("查询评分表")
@PostMapping("getEvaluationForm")
public ResponseMessage getEvaluationForm(@RequestBody FormVO form){
@GetMapping("getEvaluationForm")
public ResponseMessage<List<QualityEvaluation>> getEvaluationForm(FormVO form){
QualityEvaluation qualityEvaluation = new QualityEvaluation();
qualityEvaluation.setLawId(form.getLawId()) ;
qualityEvaluation.setUserId(form.getUserId()) ;
qualityEvaluation.setEvaluationType(form.getEvaluationType());
iQualityEvaluationService.getEvaluationForm(qualityEvaluation);
List<QualityEvaluation> evaluationForm = iQualityEvaluationService.getEvaluationForm(qualityEvaluation);
return null;
return Result.success(evaluationForm);
}
@@ -23,4 +23,7 @@ public interface QualityEvaluationDao extends BaseMapper<QualityEvaluation> {
public IPage<QualityEvaluation> getHistory(IPage<QualityEvaluation> page,@Param(Constants.WRAPPER) QueryWrapper<QualityEvaluation> queryWrapper);
public List<QualityEvaluation> getEvaluationForm(@Param(Constants.WRAPPER) QueryWrapper<QualityEvaluation> queryWrapper);
}
@@ -77,13 +77,35 @@ public class QualityEvaluation extends BaseEntity {
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime modifyTime;
private Date modifyTime;
@TableField(exist = false)
@ApiModelProperty(value = "指标名称")
private String indexTitle;
@ApiModelProperty(value = "一级指标名称")
@TableField(exist = false)
private String oneIndexTitle;
@ApiModelProperty(value = "二级指标名称")
@TableField(exist = false)
private String twoIndexTitle;
@ApiModelProperty(value = "三级指标名称")
@TableField(exist = false)
private String threeIndexTitle;
@ApiModelProperty(value = "指标权重")
@TableField(exist = false)
private String weight;
@TableField(exist = false)
private Integer page;
@@ -26,5 +26,5 @@ public interface IQualityEvaluationService extends IService<QualityEvaluation> {
public List<QualityEvaluation> getEvaluationForm(QualityEvaluation query);
Map<String,Double> getScore(String lawId);
Map<String, Double> getScore(String lawId);
}
@@ -58,6 +58,7 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
List<QualityEvaluation> tableData = form.getTableData();
tableData.forEach(item->{
item.setModifyTime(new Date());
item.setId( UUIDUtils.randomUUID20());
if ("number".equals(item.getValueType()) ){
item.setScore(String.valueOf (Double.valueOf(item.getScore()) * 2) );
@@ -83,6 +84,7 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
queryWrapper.eq("evaluation_type",query.getEvaluationType());
}
queryWrapper.eq("`index`.value_type","number");
//sql计算每个用户的评分
return qualityEvaluationDao.getHistory(page,queryWrapper);
@@ -95,9 +97,6 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
public List<QualityEvaluation> getEvaluationForm(QualityEvaluation query) {
QueryWrapper<QualityEvaluation> queryWrapper = new QueryWrapper<>();
queryWrapper.select("UNAME as userName","score","reason","create_time as createTime","modify_time as modifyTime","idx.value_type as valueType")
.last("JOIN ts_user user ON quality_evaluation.user_id = user.USID" +
"LEFT JOIN evaluation_index as idx on iex.id=quality_evaluation.evaluation_index");
if (query.getLawId()!=null){
@@ -113,8 +112,7 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
queryWrapper.eq("evaluation_type",query.getEvaluationType());
}
return this.baseMapper.selectList(queryWrapper);
return qualityEvaluationDao.getEvaluationForm(queryWrapper);
}
@@ -124,33 +122,48 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
@Override
public Map<String, Double> getScore(String lawId) {
QueryWrapper<QualityEvaluation> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("law_id",lawId);
List<QualityEvaluation> list = this.list(queryWrapper);
queryWrapper.eq("law_id",lawId)
.eq("`index`.value_type","number");
return list.stream()
Page<QualityEvaluation> page = new Page<>(1, 1000);
List<QualityEvaluation> list = qualityEvaluationDao.getHistory(page, queryWrapper).getRecords();
// return list.stream()
// .collect(Collectors.groupingBy(QualityEvaluation::getEvaluationType,
// Collectors.groupingBy(QualityEvaluation::getEvaluationIndex,
// Collectors.averagingDouble(item -> Double.valueOf(item.getScore()))
// )
// ));
HashMap<String, Double> result = new HashMap<>();
result.put("dynamic",0.0);
result.put("quality",0.0);
result.putAll(list.stream()
.collect(Collectors.groupingBy(QualityEvaluation::getEvaluationType,
Collectors.averagingDouble(item -> getScoreSingle(item))));
Collectors.averagingDouble(item ->Double.valueOf(item.getScore()) ))));
return result;
}
private Double getScoreSingle(QualityEvaluation item){
QueryWrapper<EvaluationIndex> indexQuery = new QueryWrapper<>();
indexQuery.select("code","weight");
List<EvaluationIndex> indexList = iEvaluationIndexService.list(indexQuery);
Map<String, Float> weightMap = indexList.stream()
.collect(Collectors.toMap(EvaluationIndex::getCode, obj -> Float.valueOf(obj.getWeight())));
String score = item.getScore();
return ((score == null || (Float.valueOf(item.getScore()) < 0.0)) ? 0.0 : Float.valueOf(score) * weightMap.get(item.getEvaluationIndex()));
}
// private Double getScoreSingle(QualityEvaluation item){
//
// QueryWrapper<EvaluationIndex> indexQuery = new QueryWrapper<>();
// indexQuery.select("code","weight")
// .eq("value_type","number");
//
// List<EvaluationIndex> indexList = iEvaluationIndexService.list(indexQuery);
//
// Map<String, Float> weightMap = indexList.stream()
// .collect(Collectors.toMap(EvaluationIndex::getCode, obj -> Float.valueOf(obj.getWeight())));
//
//
//
// String score = item.getScore();
// return (score == null && !weightMap.containsKey(item.getEvaluationIndex()) ) ? 0.0 : Float.valueOf(score) * weightMap.get(item.getEvaluationIndex());
// }
@@ -102,10 +102,7 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
List<SarPublicIdeaAll> data=new ArrayList<>();
if (!StringUtils.isEmpty(cid)){
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
wrapper.eq(SarPublicIdeaAll.CID,cid);
wrapper.orderByAsc("part_code");
data=sarPublicIdeaAllDao.selectList(wrapper);
data=sarPublicIdeaAllDao.getPublicAllIdea(cid);
}
List<GetExcelDto> standExcel=new ArrayList<>();
for (SarPublicIdeaAll sarPublicIdeaAll:data){
@@ -26,4 +26,6 @@ public interface SarPublicIdeaAllDao extends BaseMapper<SarPublicIdeaAll> {
List<SarPublicIdeaAll> getAllDataByIdea(@Param("page")Integer page,@Param("size")Integer size, @Param("ideaId")String ideaId);
Integer getAllDataByIdeaCount( @Param("ideaId")String ideaId);
List<SarPublicIdeaAll> getPublicAllIdea(@Param("cid") String cid);
}
@@ -25,11 +25,11 @@ public class FindSarItemsPageReqDTO extends BasePage {
@ApiModelProperty(value = "新车型实施日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date XCXSSRQ;
private String XCXSSRQ;
@ApiModelProperty(value = "在产车实施日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date ZCCSSRQ;
private String ZCCSSRQ;
@ApiModelProperty(value = "文件类型")
private String fileType;
@@ -125,12 +125,12 @@ public class SarStandItems extends BaseEntity {
@ApiModelProperty(value = "新车型实施日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("XCXSSRQ")
private Date xccssrq;
private String xccssrq;
@ApiModelProperty(value = "在产车实施日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("ZCCSSRQ")
private Date zccssrq;
private String zccssrq;
@ApiModelProperty(value = "符合性要求-符合性状态")
@@ -236,7 +236,7 @@ public class SarStandItemsServiceImpl extends ServiceImpl<SarStandItemsDao, SarS
switch (page.getOrderBy()){
case "itemsNum" : page.setOrderBy("ITEMS_NUM"); break;
default:page.setOrderBy("ITEMS_NUM"); page.setOrder("DESC");
default:page.setOrderBy("ITEMS_NUM"); page.setOrder("ASC");
}
switch (page.getOrder()){
@@ -4,8 +4,11 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* //TODO 添加类/接口功能描述
@@ -131,9 +131,11 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
@GetMapping("/exprotWarning")
@GetMapping("/exportWarning")
@ApiOperation("导出预警")
public void exportStandardsInfoExcel(WarningExcelVO excelVO, HttpServletResponse response) throws Exception {
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
try {
response.setContentType("application/vnd.ms-excel");
@@ -145,11 +147,12 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
String fileName = URLEncoder.encode(excelVO.getExportName(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
// 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), SarStandIssueControlProduct.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
EasyExcel.write(response.getOutputStream(), StandWarningEO.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(exportExcel);
} catch (Exception e) {
System.out.println(e);
@@ -11,6 +11,9 @@ import java.util.List;
public interface EarlyWarningEODao extends BaseMapper<EarlyWarningEO> {
IPage<StandWarningEO> selectWarningPage(IPage<StandWarningEO> page, @Param("waringEO") StandWarningEO warningEO,@Param("idList") List<String> ids);
IPage<StandWarningEO> selectWarningPage(IPage<StandWarningEO> page, @Param("waringEO") StandWarningEO warningEO);
List<StandWarningEO> exportWarning(@Param("idList") List<String> ids);
}
@@ -37,6 +37,11 @@ public class EarlyWarningEO extends BaseEntity {
@TableField("STAND_ID")
private String standId;
@ExcelIgnore
@ApiModelProperty("分解单条款id")
@TableField("ITEM_ID")
private String itemId;
@ExcelIgnore
@ApiModelProperty("标准类别")
@TableField(exist = false)
@@ -14,6 +14,9 @@ public class WarningDate {
@TableField("law_id")
private String lawId;
@TableField("itemId")
private String itemId;
@TableField("SSRQ")
private String SSRQ;
@@ -112,7 +112,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
@Override
public IPage<StandWarningEO> getStandWarning(StandWarningEO queryPage) {
IPage<StandWarningEO> iPage = new Page<>(queryPage.getPage(),queryPage.getPageSize());
return earlyWarningEODao.selectWarningPage(iPage,queryPage,null);
return earlyWarningEODao.selectWarningPage(iPage,queryPage);
}
/**
@@ -121,8 +121,10 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
*/
@Override
public List<StandWarningEO> getExportExcel(WarningExcelVO excelVO){
IPage<StandWarningEO> standWarningEOIPage = earlyWarningEODao.selectWarningPage(null, null, excelVO.getIds());
return standWarningEOIPage.getRecords();
List<StandWarningEO> standWarningEOList = earlyWarningEODao.exportWarning( excelVO.getIds());
// IPage<StandWarningEO> standWarningEOIPage = earlyWarningEODao.selectWarningPage(null, null, null);
return standWarningEOList;
}
@@ -127,6 +127,44 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
@GetMapping("/getSarStandardsInfoPageByWk1")
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
public ResponseMessage<PageInfo<SarStandardsInfo>> getSarStandardsInfoPageByWk1(SarStandardsInfoEOPage page,@RequestParam(defaultValue = "0") String mark) throws Exception {
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
String advanceStr = SarAdvanceSearchUtil.createStandSql(searchList);
if (StringUtils.isNotBlank(advanceStr)) {
page.setAdvanceSearchStr(advanceStr);
} else {
page.setAdvanceSearchStr(null);
}
}
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
List<SarStandardsInfo> rows = sarStandardsInfoEOService.getSarStandardsInfoPageByWk1(page);
// 去掉日期时分秒
rows.forEach(item->{
Optional.ofNullable(item.getSSRQ())
.ifPresent(SSRQ -> item.setSSRQ(item.getSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
Optional.ofNullable(item.getXCXSSRQ())
.ifPresent(SSRQ ->item.setXCXSSRQ(item.getXCXSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
Optional.ofNullable(item.getZCCSSRQ())
.ifPresent(SSRQ ->item.setZCCSSRQ(item.getZCCSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
});
return Result.success(getPageInfo(page.getPager(), rows));
}
private void nowOrderFunc(SarStandardsInfoEOPage page) {
@@ -21,6 +21,8 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
List<SarStandardsInfo> getSarStandardsInfoPage(SarStandardsInfoEOPage page) throws Exception;
List<SarStandardsInfo> getSarStandardsInfoPageByWk1(SarStandardsInfoEOPage page) throws Exception;
List<SarStandardsInfo> getSarStandardsInfoPageBak(SarStandardsInfoEOPage page) throws Exception;
List<SarStandardsInfo> getSarStandardsInfoPageBak1(SarStandardsInfoEOPage page) throws Exception;
@@ -321,6 +321,34 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return sarlist;
}
@Override
public List<SarStandardsInfo> getSarStandardsInfoPageByWk1(SarStandardsInfoEOPage page) throws Exception {
//查询当前登录人角色拥有权限的菜单
if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())){
QueryWrapper<TsResource> qw = new QueryWrapper<>();
qw.eq("ID",page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if(children.isEmpty() && !page.getMenuId().equals("nomenu")){
// List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
// if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
// page.setMenuRoleList(getMenuIdList);
// } else {
// page.setMenuRoleList(null);
// }
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
}
Integer rowCount = dao.getSarStandardsInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarStandardsInfo> sarlist = dao.getSarStandardsInfoPage(page,"996");
attrInfoCollect(sarlist);
return sarlist;
}
@Override
public List<SarStandardsInfo> getSarStandardsInfoPageBak(SarStandardsInfoEOPage page) throws Exception {
//查询当前登录人角色拥有权限的菜单
@@ -108,7 +108,7 @@ public class FieldConvertUtil {
List<String> timeList = Arrays.asList(timeStr.split(","));
List<String> collect = timeList.stream()
.map(item -> "str_to_date('" + item + "','%Y-%m-%d %H:%i:%s')")
.map(item -> "str_to_date('" + item + "','%Y-%m-%d')")
.collect(Collectors.toList());
timeStr ="concat(" + String.join(", \',\' ,", collect) + ")";
} else {
@@ -143,7 +143,7 @@ public class FieldConvertUtil {
String mustValue = "'"+ UUIDUtils.randomUUID20() + "','" + id + "','0','"
+ LoginUserUtil.getUserId() + "'";
Date date = new Date();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
String nowTime = sf.format(date);
String timeValue = "," + changeTimeValue(nowTime);
mustValue += timeValue + timeValue;
@@ -390,10 +390,10 @@
and ITEMS_NAME like CONCAT('%', #{itemsName},'%')
</if>
<if test="XCXSSRQ !=null">
and XCXSSRQ=#{XCXSSRQ}
and XCXSSRQ like concat('%', #{XCXSSRQ},'%')
</if>
<if test="ZCCSSRQ !=null">
and ZCCSSRQ=#{ZCCSSRQ}
and ZCCSSRQ like concat('%',#{ZCCSSRQ},'%')
</if>
</where>
</sql>
@@ -8,17 +8,50 @@
SELECT
`user`.UNAME AS userName,
eva.user_id,
avg(eva.score * iex.weight) AS score,
iex.index_type as valueType
`index`.value_type as valueType,
eva.evaluation_type as evaluationType,
avg(eva.score * `index`.weight) AS score,
min(eva.create_time) as createTiem,
max(eva.modify_time) as modifyTime
FROM
quality_evaluation AS eva
LEFT JOIN ts_user `user` ON eva.user_id = `user`.USID
LEFT JOIN evaluation_index AS iex ON eva.evaluation_index = iex.id
LEFT JOIN evaluation_index AS `index` ON eva.evaluation_index = `index`.id
${ew.customSqlSegment}
GROUP BY
userName,
eva.user_id,
index_type
index_type,
valueType,
evaluationType
ORDER BY modifyTime DESC
${ew.customSqlSegment}
</select>
<select id="getEvaluationForm"
resultType="com.adc.da.slrs.sarEnterpriseStandardEvaluation.entity.QualityEvaluation">
SELECT
UNAME AS userName,
score,
reason,
evaluation_index as evaluationIndex,
quality_evaluation.create_time AS createTime,
quality_evaluation.modify_time AS modifyTime,
`index`.value_type AS valueType,
`index`.three_index_title as indexTitle,
`index`.one_index_title as oneIndexTitle,
`index`.two_index_title as twoIndexTitle,
`index`.three_index_title as threeIndexTitle,
`index`.weight as weight
FROM
quality_evaluation
LEFT JOIN ts_user `user` ON quality_evaluation.user_id = `user` .USID
LEFT JOIN evaluation_index AS `index` ON `index`.id = quality_evaluation.evaluation_index
${ew.customSqlSegment}
ORDER BY `index`.index_sort
</select>
</mapper>
@@ -24,4 +24,12 @@
FROM sar_public_idea_all WHERE
idea_id = #{ideaId}
</select>
<select id="getPublicAllIdea" resultType="com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll">
SELECT sar_public_idea_all.id,reason,ts_user.INSTITUTION_NAME as deptName,old_text,new_text,dept_id,part_code,user_name,user_id,content,idea_id,cid
FROM sar_public_idea_all
left join ts_user on ts_user.USID=sar_public_idea_all.user_id
WHERE cid = #{cid}
ORDER BY part_code ASC
</select>
</mapper>
@@ -38,16 +38,7 @@
<sql id="stand_where">
<if test="idList != null and idList.size() > 0">
warning.ID
IN
<foreach collection="idList" item="id" open="and (" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
<if test="waringEO.standCode != null and waringEO.standCode != ''">
AND trim(replace(CONCAT(
@@ -83,6 +74,92 @@
)
</if>
</sql>
<select id="exportWarning" resultType="com.adc.da.slrs.sarStandWarning.entity.StandWarningEO">
SELECT WARNING_RESULT.* FROM
(
SELECT
<include refid="stand_column"/>
,
attr.CLLX AS
APPLY_TYPE ,
attr
.ZRGCS AS DUTY_ENGINEER ,
NULL AS ITEMS_ID ,
NULL AS ITEMS_NUM , NULL AS ITEMS_NAME ,
NULL AS POLICY_ID ,
NULL AS POLICY_NAME ,
MARK ,
POWER,
attr.XCXSSRQ AS XCXSSRQ ,
attr.ZCCSSRQ AS ZCCSSRQ
FROM sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo on sarInfo.id=warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr on attr.STAND_ID=warning.STAND_ID
<where>
POWER = '1'
AND (MARK = 'stand')
<if test="idList != null and idList.size() > 0">
AND
warning.ID
IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
</where>
UNION ALL
SELECT
<include refid="stand_column"/> ,
items.APPLY_ARCTIC AS APPLY_TYPE ,
items.DUTY_ENGINEER AS DUTY_ENGINEER ,
items.ID AS ITEMS_ID ,
items.ITEMS_NUM ,
items.ITEMS_NAME ,
NULL AS POLICY_ID ,
NULL AS POLICY_NAME ,
MARK ,
POWER,
items.XCXSSRQ AS XCXSSRQ ,
items.ZCCSSRQ AS ZCCSSRQ
FROM
sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo ON sarInfo.id = warning.STAND_ID
LEFT JOIN sar_stand_items AS items ON items.STAND_ID = warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr ON attr.STAND_ID = warning.STAND_ID
<where>
POWER = '1'
AND (MARK = 'item')
<if test="idList != null and idList.size() > 0">
AND
warning.ID
IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
</where>
)
WARNING_RESULT
LEFT JOIN
(
SELECT law_id,MIN(SSRQ) SSRQ_MIN FROM warning_date
GROUP BY warning_date.law_id
) warning_date
ON warning_date.law_id = WARNING_RESULT.STAND_ID
ORDER BY warning_date.SSRQ_MIN
</select>
<select id="selectWarningPage" resultMap="resultMap">
SELECT WARNING_RESULT.* FROM
@@ -51,15 +51,23 @@
<select id="getWarningId" resultType="com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO">
SELECT
law_id as STAND_ID,
'-1' AS itemsId,
'stand' AS mark,
'1' as power
law_id AS standId,
item_id AS itemId,
CASE
WHEN item_id = '-1' THEN
'stand'
WHEN
item_id IS NULL THEN
'stand'
ELSE
'item'
END AS mark,
'1' as power
FROM
warning_date AS warning
WHERE
DATE_FORMAT(warning.SSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
UNION
<!-- UNION
SELECT
STAND_ID,
ID AS itemsId,
@@ -70,7 +78,7 @@
WHERE
DATE_FORMAT(item.XCXSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
OR
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d') -->
</select>
@@ -79,25 +87,44 @@
SELECT lawId,timeName,DATE_FORMAT(SSRQ,'%Y-%m-%d') as SSRQ FROM
(
select attr.STAND_ID as lawId,'SSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
select attr.STAND_ID as lawId,'-1' as itemId,'SSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
UNION ALL
UNION ALL
select attr.STAND_ID as lawId,'XCXSSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.XCXSSRQ) - length(replace(attr.SSRQ,',',''))+1)
UNION ALL
select attr.STAND_ID as lawId,'ZCCSSRQ' as timeName,
substring_index(substring_index(attr.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
select attr.STAND_ID as lawId,'-1' as itemId,'XCXSSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.XCXSSRQ) - length(replace(attr.XCXSSRQ,',',''))+1)
UNION ALL
select attr.STAND_ID as lawId,'-1' as itemId,'ZCCSSRQ' as timeName,
substring_index(substring_index(attr.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.SSRQ) - length(replace(attr.ZCCSSRQ,',',''))+1)
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
substring_index(substring_index(item.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_items item
join mysql.help_topic b
on b.help_topic_id &gt; (length(item.ZCCSSRQ) - length(replace(item.ZCCSSRQ,',',''))+1)
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
substring_index(substring_index(item.XCXSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_items item
join mysql.help_topic b
on b.help_topic_id &gt; (length(item.XCXSSRQ) - length(replace(item.XCXSSRQ,',',''))+1)
) as T
WHERE
@@ -758,6 +758,9 @@
(trim(replace(concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',
SAR_STANDARDS_INFO.STAND_YEAR),' ','')) like trim(replace(concat(concat('%',#{page.standNumber}),'%'),' ','')) and SAR_STANDARDS_INFO.STAND_YEAR != '')
or (trim(replace(concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER),' ','')) like trim(replace(concat(concat('%',#{page.standNumber}),'%'),' ',''))
<if test="mark == 996">
or (stand_name like concat(concat('%',#{page.standNumber}),'%'))
</if>
)
<!-- and SAR_STANDARDS_INFO.STAND_YEAR = ''-->
<!-- or (stand_name like concat(concat('%',#{page.standNumber}),'%')) -->