feat: There is no way the, TO optimize the query

This commit is contained in:
super_liu
2021-10-22 15:50:07 +08:00
parent d8053efe8e
commit 9eff2340a2
16 changed files with 503 additions and 101 deletions
+6
View File
@@ -43,6 +43,12 @@
<version>5.5.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -0,0 +1,74 @@
package com.adc.da.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* token 工具类
*
* @author ch
* @version 1.0.0
* @since 1.0.0
* <p>
* Created at 2020/7/30 2:23 下午
*/
@Component
public class JwtSysUtils {
// 过期时间
private static long expire = 6048000;
// 秘钥
private static String secret = "HSyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9";
/**
* 创建一个token
*
* @param userId
* @return
*/
public String generateToken(String userId) {
Date now = new Date();
Date expireDate = new Date(now.getTime() + expire);
return Jwts.builder().setHeaderParam("type", "JWT").setSubject(userId).setIssuedAt(now)
.setExpiration(expireDate).signWith(
SignatureAlgorithm.HS512, secret).compact();
}
/**
* 解析token
*/
public Claims getClaimsByToken(String token) {
Claims claims;
try {
claims = Jwts.parser()
.setSigningKey(secret) // 设置标识名
.parseClaimsJws(token) //解析token
.getBody();
} catch (ExpiredJwtException e) {
claims = e.getClaims();
}
return claims;
}
public String getUserIdByToken(){
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String user = "";
if(attributes != null){
HttpServletRequest request = attributes.getRequest();
Claims claim = getClaimsByToken(request.getHeader("token"));
user = claim.getSubject();
}
return user;
}
}
@@ -15,21 +15,7 @@ public class LoginUserUtil {
*
*/
public static String getUserId() {
String userId = null;
try {
Subject subject = SecurityUtils.getSubject();
Object object=subject.getPrincipal();
if(object!=null){
String json = JSONObject.toJSONString(object);
if(json!=null && json.length()>0){
Map<String, Object> userInfo=JSONObject.parseObject(json, Map.class);
userId=userInfo.get("id").toString();
}
}
} catch (UnavailableSecurityManagerException e) {
} catch (InvalidSessionException e) {
}
return userId;
return UserSysUtils.getUserId();
}
public static String getUserParamValue() {
@@ -0,0 +1,97 @@
package com.adc.da.util;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.UnavailableSecurityManagerException;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.session.InvalidSessionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
public class UserSysUtils {
private UserSysUtils() {
super();
}
private static Logger logger = LoggerFactory.getLogger(UserSysUtils.class);
/**
* 当前登陆用户
*/
public static final String CURRENT_USER = "currentUser";
/**
* 角色信息
*/
public static final String CACHE_ROLE_LIST = "roleList";
/**
* 菜单信息
*/
public static final String CACHE_MENU_LIST = "menuList";
public static final String CACHE_MENU_TREE = "menuTree";
public static final String CACHE_AREA_LIST = "areaList";
public static final String CACHE_OFFICE_LIST = "officeList";
/**
* @see JwtSysUtils
*/
private static JwtSysUtils jwtUtils = SpringContextHolder1.getBean(JwtSysUtils.class);
/**
* 退出
*/
public static void logout() {
try {
SecurityUtils.getSubject().logout();
} catch (UnavailableSecurityManagerException e) {
logger.error(e.getMessage(),e);
} catch (InvalidSessionException e) {
logger.error(e.getMessage(),e);
}
}
/**
* 获取当前登陆用户ID
* @throws Exception
*/
public static String getUserId() {
return jwtUtils.getUserIdByToken();
}
public static void flush() {
CacheUtils.removeCache(CURRENT_USER);
}
private static final class CacheUtils {
public static Object getCache(String key) {
return getCache(key, null);
}
public static Object getCache(String key, Object defaultValue) {
Object obj = getCacheMap().get(key);
return obj == null ? defaultValue : obj;
}
public static void putCache(String key, Object value) {
getCacheMap().put(key, value);
}
public static void removeCache(String key) {
getCacheMap().remove(key);
}
public static Map<String, Object> getCacheMap() {
Map<String, Object> map = Maps.newHashMap();
return map;
}
}
}
@@ -194,6 +194,16 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
return Result.success(result);
}
@ApiOperation(value = "|SarBussionessStandEO|详情")
@GetMapping("/getStandInfoUpdateById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarBussionessStand> getStandInfoUpdateById(String id) throws Exception {
SarBussionessStand result = sarBussionessStandEOService.selectStandardsInfoUpdateByKey(id);
String collectId = personCollectEOService.queryCollectByUserAndId(id);
result.setCollectId(collectId);
return Result.success(result);
}
/**
* 给指定标准配置目录
* @param standardsInfoEO
@@ -30,6 +30,8 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
SarBussionessStand selectStandardsInfoByKey(String id) throws Exception;
SarBussionessStand selectStandardsInfoUpdateByKey(String id) throws Exception;
SarBussionessStandEOPage updateStandardsMenu(SarBussionessStandEOPage standardsInfoEO);
List<SarBussionessStand> queryByList(SarBussionessStandEOPage sarBussionessStandEOPage);
@@ -35,6 +35,7 @@ import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
@@ -60,6 +61,7 @@ import org.springframework.stereotype.Service;
import java.sql.Clob;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -708,6 +710,19 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
return sarBussionessStandEO;
}
@Override
public SarBussionessStand selectStandardsInfoUpdateByKey(String id) throws Exception{
List<SarBussionessStand> sarBussionessStandlist = this.baseMapper.selectStandardsInfoByKey(id);
SarBussionessStand sarBussionessStandEO = new SarBussionessStand();
if(!sarBussionessStandlist.isEmpty()) {
List<SarBussionessStand> newStandList = new ArrayList<>();
newStandList.add(sarBussionessStandlist.get(0));
attrInfo(newStandList);
sarBussionessStandEO = newStandList.get(0);
}
return sarBussionessStandEO;
}
public void attrInfoShowDetails(List<SarBussionessStand> sarlist) throws Exception {
for (SarBussionessStand row : sarlist) {
attrInfoDetails(row);
@@ -802,7 +817,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarBussionessStand> sarlist = this.baseMapper.getBussionessStandInfoPage(page);
attrInfo(sarlist);
attrInfoCollect(sarlist);
return sarlist;
}
@@ -817,6 +832,17 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
}
public void attrInfoCollect (List<SarBussionessStand> sarlist) throws Exception {
List<String> collectResIds = sarlist.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
Map<String,String> collectMap = personCollectEOService.queryCollectByUserAndIds(collectResIds);
for (SarBussionessStand row : sarlist) {
if(collectMap != null && collectMap.get(row.getId()) != null){
row.setCollectId(collectMap.get(row.getId()));
}
}
}
public void attrInfo1 (SarBussionessStand row) throws Exception {
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
@@ -939,13 +965,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if (value1 != null && value1.toString().equals("\"null\"")){
entry.setValue("");
}
if ("SVPPS".equals(name)) {
Object value = entry.getValue();
if (value != null && StringUtils.isNotBlank(value.toString())) {
value = sysInfoEOService.getSvppsNamesByIds(value.toString());
}
newMap.put(name + "Name",value);
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
@@ -466,6 +466,14 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
return Result.success(result);
}
@ApiOperation(value = "|SarStandardsInfoEO|修改详情")
@GetMapping("/getStandInfoUpdateById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarStandardsInfo> findUpdateById(String id) throws Exception {
SarStandardsInfo result = sarStandardsInfoEOService.selectStandardsInfoUpdateByKey(id);
return Result.success(result);
}
@ApiOperation(value = "|SarStandardsInfoEO|确认配置标准")
@PostMapping("/saveStandardsMenu")
//@RequiresPermissions("lawss:sarStandardsInfo:saveStandardsMenu")
@@ -37,6 +37,8 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
SarStandardsInfo selectStandardsInfoByKey(String id) throws Exception;
SarStandardsInfo selectStandardsInfoUpdateByKey(String id) throws Exception;
public void attrInfoDetails (SarStandardsInfo row) throws Exception;
boolean updateStandardsMenu(SarStandardsInfoEOPage standardsInfoEO);
@@ -307,10 +307,16 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
Integer rowCount = dao.getSarStandardsInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarStandardsInfo> sarlist = dao.getSarStandardsInfoPage(page);
attrInfo(sarlist);
attrInfoCollect(sarlist);
return sarlist;
}
public void attrInfo(List<SarStandardsInfo> sarlist) throws Exception {
for (SarStandardsInfo row : sarlist) {
attrInfoDetails(row);
}
}
/***
* @Description: 处理属性表数据
* @Author: super_liu
@@ -318,9 +324,13 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
* @Param: [sarlist]
* @Return: void
*/
public void attrInfo(List<SarStandardsInfo> sarlist) throws Exception {
public void attrInfoCollect(List<SarStandardsInfo> sarlist) throws Exception {
List<String> collectResIds = sarlist.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
Map<String,String> collectMap = personCollectEOService.queryCollectByUserAndIds(collectResIds);
for (SarStandardsInfo row : sarlist) {
attrInfoDetails(row);
if(collectMap != null && collectMap.get(row.getId()) != null){
row.setCollectId(collectMap.get(row.getId()));
}
}
}
@@ -344,44 +354,11 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
Map<String, Object> newMap = new HashMap<>();
if (getAttrMap != null) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
if ("EOPSSRQ".equals(entry.getKey())) {
if (entry.getValue() != null && entry.getValue().toString().length() > 10) {
String time = DateUtil.formatStrUTCToDateStr(entry.getValue().toString());
entry.setValue(time);
}
}
String name = entry.getKey();
if ("\"null\"".equals(entry.getValue())) {
entry.setValue("");
}
if ("SVPPS".equals(name)) {
Set<String> set = new HashSet();
// 查询条款svpps
Set<String> itemSvpps = sarStandItemsEODao.selectSvppsByStandId(row.getId(), null, null);
if (itemSvpps != null && !itemSvpps.isEmpty()) {
set.addAll(itemSvpps);
}
Object value = entry.getValue();
if (value != null && StringUtils.isNotBlank(value.toString())) {
set.addAll(Arrays.asList(value.toString().split(",")));
}
String allVal = ConcatStringUtil.concatSet(set);
if (StringUtils.isNotBlank(allVal)) {
entry.setValue(allVal);
value = sysInfoEOService.getSvppsNamesByIds(allVal);
}
newMap.put(name + "Name", value);
} else if ("YQLX".equals(name)) {
//要求类型来源于条款
SarStandItems sarStandItemsEO = new SarStandItems();
sarStandItemsEO.setStandId(row.getId());
Set<String> itemClaimType = sarStandItemsEODao.selectClaimTypesByStandId(row.getId(), null, null);
if (itemClaimType != null && itemClaimType.size() > 1) {
entry.setValue("RENVECPFGT");
} else if (itemClaimType != null && itemClaimType.size() == 1) {
entry.setValue(itemClaimType.toArray()[0]);
}
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMap.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
@@ -2156,6 +2133,30 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return sarStandardsInfoEO;
}
public SarStandardsInfo selectStandardsInfoUpdateByKey(String id) throws Exception {
//查询出详情信息
List<SarStandardsInfo> resultlist = dao.selectStandardsInfoByKey(id);
SarStandardsInfo sarStandardsInfoEO = new SarStandardsInfo();
if (resultlist.size() > 0) {
List<SarStandardsInfo> sarStandardsInfoEOList = new ArrayList<>();
sarStandardsInfoEOList.add(resultlist.get(0));
attrInfo(sarStandardsInfoEOList);
sarStandardsInfoEO = sarStandardsInfoEOList.get(0);
}
// 查询纳入清单的国家地区
if (sarStandardsInfoEO != null) {
if(sarStandardsInfoEO.getStandSystem() != null){
SarMenuStandard menu = sarMenuStandardService.selectMenuById(sarStandardsInfoEO.getStandSystem());
if(menu != null){
sarStandardsInfoEO.setStandSystemName(menu.getMenuName() == null ? "" : menu.getMenuName());
}
}
String accessCountry = sarSarAccessEOService.getCountryByRes(sarStandardsInfoEO.getId(), sarStandardsInfoEO.getStandType() + "_STAND");
sarStandardsInfoEO.setAccessCountry(accessCountry);
}
return sarStandardsInfoEO;
}
public boolean updateStandardsMenu(SarStandardsInfoEOPage standardsInfoEO) {
SarStandMenu sarStandMenuEO = new SarStandMenu();
String nowMenuId = standardsInfoEO.getMenuId();
@@ -47,7 +47,7 @@
<sql id="Base_Column_List_show" >
SAR_BUSSIONESS_STAND.modify_time,
SAR_BUSSIONESS_STAND.creation_time, SAR_BUSSIONESS_STAND.valid_flag,
SAR_BUSSIONESS_STAND.apply_country, SAR_BUSSIONESS_STAND.stand_nature,SAR_BUSSIONESS_STAND.stand_sort,
SAR_BUSSIONESS_STAND.apply_country, SAR_BUSSIONESS_STAND.stand_nature,SAR_BUSSIONESS_STAND.stand_sort,SAR_BUSSIONESS_STAND.stand_year,
stand_status, replaced_stand_num,replace_stand_num,put_time,issue_time,stand_en_name,
stand_name, stand_code,SAR_BUSSIONESS_STAND.id,SAR_BUSSIONESS_STAND.text_status_buss
</sql>
@@ -544,53 +544,214 @@
</trim>
</sql>
<sql id="SarStandardsInfo_in_left">
left join SAR_STAND_MENU ON SAR_STANDARDS_INFO.id = SAR_STAND_MENU.stand_id
where 1=1 and SAR_STANDARDS_INFO.valid_flag=0
<trim suffixOverrides=",">
<!-- 标准分类 国内标准,国外标准 必要搜索项 -->
<if test='standType != null and standType != "ALL"'>
and stand_type = #{standType}
</if>
<!-- 基本搜索项 -->
<!-- 国家、地区 -->
<if test="country != null and country != ''">
and country = #{country}
</if>
<!-- 标准编号111 -->
<if test="standNumber != null and standNumber != ''">
and (
(concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',
SAR_STANDARDS_INFO.STAND_YEAR) like concat(concat('%',#{standNumber}),'%') and SAR_STANDARDS_INFO.STAND_YEAR != '')
or (concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER) like concat(concat('%',#{standNumber}),'%')
and SAR_STANDARDS_INFO.STAND_YEAR = '')
or (stand_name like concat(concat('%',#{standNumber}),'%'))
)
</if>
<!-- 标准名称 -->
<if test="standName != null and standName != ''">
and stand_name like concat(concat('%',#{standName}),'%')
or STAND_NUMBER like concat(concat('%',#{standName}),'%')
or STAND_YEAR like concat(concat('%',#{standName}),'%')
or STAND_SORT like concat(concat('%',#{standName}),'%')
</if>
<if test="standEnName != null and standEnName != ''">
and stand_en_name like concat(concat('%',#{standEnName}),'%')
</if>
<!-- 标准状态 -->
<if test="standState != null and standState != ''">
and stand_state = #{standState}
</if>
<!-- 高级检索项 -->
<!-- 标准性质 -->
<if test="standNature != null and standNature != ''">
and stand_nature = #{standNature}
</if>
<!-- 代替标准 允许输入的时候输入多个-->
<if test="replaceStandNum != null and replaceStandNum != ''">
and replace_stand_num like concat(concat('%',#{replaceStandNum}),'%')
</if>
<!-- 被代替标准 -->
<if test="replacedStandNum != null and replacedStandNum != ''">
and replaced_stand_num like concat(concat('%',#{replacedStandNum}),'%')
</if>
<if test="isRelateAccess != null and isRelateAccess != ''" >
and is_relate_access = #{isRelateAccess}
</if>
<!-- 目录判断 -->
<if test="menuId != null and menuId !='nomenu' and menuAllChildrenIdList != null">
and SAR_STAND_MENU.MENU_ID in
<foreach collection="menuAllChildrenIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 游离态标准查询 -->
<!-- <if test="menuId != null and menuId =='nomenu' and standType =='INLAND'">
and SAR_STAND_MENU.MENU_ID = (select TS_RESOURCE.id from TS_RESOURCE WHERE parent_id is null and sor_divide
='INLAND_STAND')
&lt;!&ndash;-查询游离态标准,编号和名称是分开的 &ndash;&gt;
<if test="standNumber != null">
and ((concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',
SAR_STANDARDS_INFO.STAND_YEAR) like concat(concat('%',#{standNumber}),'%') and SAR_STANDARDS_INFO.STAND_YEAR is not null)
or (concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER) like concat(concat('%',#{standNumber}),'%')
and SAR_STANDARDS_INFO.STAND_YEAR is null))
</if>
</if>
<if test="menuId != null and menuId =='nomenu' and standType =='FOREIGN'">
and SAR_STAND_MENU.MENU_ID = (select TS_RESOURCE.id from TS_RESOURCE WHERE parent_id is null and sor_divide
='FOREIGN_STAND')
<if test="standNumber != null">
and ((concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',
SAR_STANDARDS_INFO.STAND_YEAR) like concat(concat('%',#{standNumber}),'%') and SAR_STANDARDS_INFO.STAND_YEAR is not null)
or (concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER) like concat(concat('%',#{standNumber}),'%')
and SAR_STANDARDS_INFO.STAND_YEAR is null))
</if>
</if> -->
<!-- 当第一次进入页面未选择记录时-->
<!-- <if test="(menuId == null or menuId =='') and standType =='INLAND'">-->
<!-- and SAR_STAND_MENU.MENU_ID in (-->
<!-- select TS_RESOURCE.id from TS_RESOURCE start with id=(select TS_RESOURCE.id from TS_RESOURCE WHERE parent_id is null-->
<!-- and sor_divide-->
<!-- ='INLAND_STAND') connect by prior id= parent_id-->
<!-- )-->
<!-- </if>-->
<!-- 新修改需求,根据角色查询有权限的菜单数据-->
<if test="menuRoleList != null">
and SAR_STAND_MENU.MENU_ID in
<foreach collection="menuRoleList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- <if test="(menuId == null or menuId =='') and standType =='FOREIGN'">-->
<!-- and SAR_STAND_MENU.MENU_ID in (-->
<!-- select TS_RESOURCE.id from TS_RESOURCE start with id=(select TS_RESOURCE.id from TS_RESOURCE WHERE parent_id is null-->
<!-- and sor_divide-->
<!-- ='FOREIGN_STAND') connect by prior id= parent_id-->
<!-- )-->
<!-- </if>-->
<!-- 导出数据过程中,选择的id -->
<if test="idlist != null">
and SAR_STANDARDS_INFO.id in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standSort != null and standSort != ''" >
and SAR_STANDARDS_INFO.stand_sort = #{standSort}
</if>
<!--标准年份-->
<if test="standYear != null and standYear != ''">
and SAR_STANDARDS_INFO.STAND_YEAR = #{standYear}
</if>
<if test="issueTime != null and issueTime != ''">
and SAR_STANDARDS_INFO.ISSUE_TIME = #{issueTime}
</if>
<!--内容摘要-->
<if test="synopsis != null and synopsis != ''" >
AND dbms_lob.instr(SYNOPSIS, #{synopsis} ,1,1) > 0
</if>
<!--文本状态-->
<if test="textStatus != null and textStatus != ''" >
and SAR_STANDARDS_INFO.TEXT_STATUS = #{textStatus}
</if>
<!--是否纳入法规清单-->
<if test="isRelateAccess != null and isRelateAccess != ''" >
and SAR_STANDARDS_INFO.IS_RELATE_ACCESS = #{isRelateAccess}
</if>
<if test="collectMenuId != null and collectMenuId != ''">
and SAR_STANDARDS_INFO.id in (
select COLLECT_RES_ID from TS_PERSON_COLLECT where TS_PERSON_COLLECT.VALID_FLAG=0
and (collect_type='INLAND_STAND' or collect_type='FOREIGN_STAND')
and TS_PERSON_COLLECT.user_id=#{userId}
)
</if>
<if test='labelMenuId != null and labelMenuId == "gxhbq"'>
and SAR_STAND_ATTR_INFO.GXHBQ is not null
</if>
<if test='labelMenuId != null and labelMenuId != "gxhbq"'>
and SAR_STAND_ATTR_INFO.GXHBQ like concat(concat('%',#{labelMenuId}),'%')
</if>
<!--适用车型-->
<if test="applyArctic != null and applyArctic != ''">
and SAR_STAND_ATTR_INFO.CLLX = #{applyArctic}
</if>
<if test="advanceSearchStr != null and advanceSearchStr != ''">
and (${advanceSearchStr})
</if>
</trim>
</sql>
<sql id="SarStandardsInfo_out_left">
left join TS_DICTYPE dicstandSort on (dicstandSort.dic_type_code = a.stand_sort and
dicstandSort.dic_id is not null and dicstandSort.valid_flag = 0 and dicstandSort.PARENT_ID is null)
LEFT JOIN TS_DICTYPE dicstandTextStatus ON (
dicstandTextStatus.dic_type_code = a.text_status
AND dicstandTextStatus.dic_id IS NOT NULL
AND dicstandTextStatus.valid_flag = 0
)
left join SAR_STAND_ATTR_INFO on (SAR_STAND_ATTR_INFO.stand_id = a.id and SAR_STAND_ATTR_INFO.valid_flag=0)
</sql>
<!-- 分页查询-->
<select id="getSarStandardsInfoPage" resultMap="BaseResultMap"
parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage">
select * from
select
a.*,
SAR_STAND_ATTR_INFO.CHJL AS CHJL,
dicstandSort.DIC_TYPE_NAME AS standSortShow,
dicstandTextStatus.DIC_TYPE_NAME AS standTextStatusShow
from
(select tmp_tb.* from
(select
<include refid="Base_Column_List_Show"/>,SAR_STAND_ATTR_INFO.CHJL AS CHJL,
(
CASE
WHEN ZCCSSRQ = 'TBD' THEN '6999-01-01'
WHEN ZCCSSRQ = '已发布' THEN '7000-01-01'
WHEN ZCCSSRQ = '已实施' THEN '7999-01-01'
WHEN ZCCSSRQ = 'N/A' THEN '8999-01-01'
WHEN ZCCSSRQ IS NULL THEN '9999-01-01'
WHEN ZCCSSRQ ='' THEN '9999-01-01'
ELSE ZCCSSRQ
END
) AS ZCCSSRQPAIXU,
(
CASE
WHEN XCXSSRQ = 'TBD' THEN '6999-01-01'
WHEN XCXSSRQ = '已发布' THEN '7000-01-01'
WHEN XCXSSRQ = '已实施' THEN '7999-01-01'
WHEN XCXSSRQ = 'N/A' THEN '8999-01-01'
WHEN XCXSSRQ IS NULL THEN '9999-01-01'
WHEN XCXSSRQ ='' THEN '9999-01-01'
ELSE XCXSSRQ
END
) AS XCXSSRQPAIXU,
(
CASE
WHEN SAR_STANDARDS_INFO.issue_time = 'TBD' THEN '6999-01-01'
WHEN SAR_STANDARDS_INFO.issue_time = '已发布' THEN '7000-01-01'
WHEN SAR_STANDARDS_INFO.issue_time = '已实施' THEN '7999-01-01'
WHEN SAR_STANDARDS_INFO.issue_time = 'N/A' THEN '8999-01-01'
WHEN SAR_STANDARDS_INFO.issue_time IS NULL THEN '9999-01-01'
WHEN SAR_STANDARDS_INFO.issue_time ='' THEN '9999-01-01'
ELSE SAR_STANDARDS_INFO.issue_time
END
) AS issueTime
SELECT
DISTINCT SAR_STANDARDS_INFO.id,
SAR_STANDARDS_INFO.stand_type,
SAR_STANDARDS_INFO.country,
SAR_STANDARDS_INFO.stand_sort,
SAR_STANDARDS_INFO.stand_number,
SAR_STANDARDS_INFO.stand_year,
SAR_STANDARDS_INFO.stand_name,
SAR_STANDARDS_INFO.stand_en_name,
SAR_STANDARDS_INFO.stand_state,
SAR_STANDARDS_INFO.stand_nature,
SAR_STANDARDS_INFO.issue_time,
SAR_STANDARDS_INFO.put_time,
SAR_STANDARDS_INFO.text_status,
SAR_STANDARDS_INFO.creation_user,
SAR_STANDARDS_INFO.valid_flag,
SAR_STANDARDS_INFO.creation_time,
SAR_STANDARDS_INFO.modify_time,
SAR_STANDARDS_INFO.STAND_SYSTEM
from SAR_STANDARDS_INFO
<include refid="SarStandardsInfo_Where_Clause"/>
GROUP BY <include refid="Group_Column_List_Show"/>,CHJL,SAR_STAND_ATTR_INFO.XCXSSRQ,SAR_STAND_ATTR_INFO.ZCCSSRQ,SAR_STAND_ATTR_INFO.SSRQ
<include refid="SarStandardsInfo_in_left"/>
order by
${orderBy1} ${order1},SAR_STANDARDS_INFO.id
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
<include refid="SarStandardsInfo_out_left"/>
</select>
<!--FIELD(SAR_STANDARDS_INFO.issue_time,'已发布'), FIELD(SAR_STANDARDS_INFO.issue_time,'TBD'), FIELD(SAR_STANDARDS_INFO.issue_time,'N/A') ,-->
<!--if(isnull(SAR_STANDARDS_INFO.issue_time),0,1) desc ,-->
@@ -598,7 +759,7 @@
<select id="getSarStandardsInfoCount" resultType="java.lang.Integer"
parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage">
select count(1) from (select count(*) from SAR_STANDARDS_INFO
<include refid="SarStandardsInfo_Where_Clause"/>
<include refid="SarStandardsInfo_in_left"/>
GROUP BY SAR_STANDARDS_INFO.id) a
</select>
@@ -25,6 +25,7 @@ public class PersonCollectEOPage extends BasePage {
private String validFlag;
private String validFlagOperator = "=";
private String collectResId;
private List<String> collectResIds;
private String collectResIdOperator = "LIKE";
private String collectInfoUri;
private String collectInfoUriOperator = "LIKE";
@@ -40,6 +41,14 @@ public class PersonCollectEOPage extends BasePage {
private List<String> collectTypeList = new ArrayList<>();
public List<String> getCollectResIds() {
return collectResIds;
}
public void setCollectResIds(List<String> collectResIds) {
this.collectResIds = collectResIds;
}
public String getModifyTime() {
return this.modifyTime;
}
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
public interface IPersonCollectEOService extends IService<TsPersonCollect> {
@@ -18,6 +19,8 @@ public interface IPersonCollectEOService extends IService<TsPersonCollect> {
public String queryCollectByUserAndId(String collectResId);
public Map<String,String> queryCollectByUserAndIds(List<String> collectResIds);
public int deleteByIdList(List<String> idList);
public int deleteByResId(String resId);
@@ -19,7 +19,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -96,6 +97,22 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
return collectId;
}
public Map<String,String> queryCollectByUserAndIds(List<String> collectResIds) {
Map<String,String> resultMap = new TreeMap<>();
String userId = LoginUserUtil.getUserId();
PersonCollectEOPage page = new PersonCollectEOPage();
page.setUserId(userId);
page.setValidFlag("0");
page.setCollectResIds(collectResIds);
List<TsPersonCollect> getCollects = this.baseMapper.queryByList(page);
List<TsPersonCollect> distinctList = getCollects.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparing(o -> o.getCollectResId()))), ArrayList::new));
resultMap = distinctList.stream().collect(Collectors.toMap(TsPersonCollect::getCollectResId, TsPersonCollect::getId));
return resultMap;
}
public int deleteByIdList(List<String> idList){
return this.baseMapper.deleteByIdList(idList);
}
@@ -49,6 +49,12 @@
<if test="collectResId != null">
and collect_res_id ${collectResIdOperator} #{collectResId}
</if>
<if test="collectResIds != null and collectResIds.size !=0">
and collect_res_id IN
<foreach collection="collectResIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="collectInfoUri != null">
and collect_info_uri ${collectInfoUriOperator} #{collectInfoUri}
</if>