feat: 迁移标准属性自定义 修改相关问题

This commit is contained in:
super_liu
2021-06-15 18:45:21 +08:00
parent e737cc225d
commit 9d704f4d1e
25 changed files with 1017 additions and 189 deletions
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarLawsAttrInfo.dao;
import com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
@@ -16,6 +17,22 @@ import java.util.Map;
*/
public interface SarLawsAttrInfoDao extends BaseMapper<SarLawsAttrInfo> {
void deleteLawsAttr(@Param("fieldInfo") String fieldInfo);
void updateAttrLen(@Param("fieldInfo") String fieldInfo);
Integer selectLawsAttrColumn(@Param("columnName") String columnName);
int insertLawsAttr(@Param("fieldInfo") String fieldInfo,@Param("fieldValue") String fieldValue);
int deleteLawsAttrByStandId(@Param("standId") String standId);
int updateLawsInfo(@Param("lawsId") String lawsId,@Param("field") String field,@Param("value") String value);
String selectFieldValByLawsId(@Param("field") String field, @Param("lawsId") String lawsId);
void alterLawsAttr(@Param("fieldInfo") String fieldInfo);
Map<String, Object> selectLawsFieldAndData(@Param("fieldInfo") String fieldInfo, @Param("standId") String standId);
}
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarLawsInfo.dao;
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -16,6 +17,8 @@ import java.util.List;
*/
public interface SarLawsInfoDao extends BaseMapper<SarLawsInfo> {
Integer selectLawsColumn(@Param("columnName") String columnName);
List<SarLawsInfo> queryByPage(SarLawsInfoEOPage page);
Integer queryByCount(SarLawsInfoEOPage page);
@@ -2,16 +2,23 @@ package com.adc.da.slrs.sarStandAttrDetails.controller;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandAttrDetails.page.SarStandAttrDetailsEOPage;
import com.adc.da.slrs.sarStandAttrDetails.service.ISarStandAttrDetailsService;
import com.adc.da.sys.common.SelectionResult;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.sarStandAttrDetails.entity.SarStandAttrDetails;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.HashMap;
@@ -27,10 +34,23 @@ import java.util.Map;
* @since 2021-06-01
*/
@RestController
@Api(tags = "福田标准法规--标准法规库--国内标准法规详情")
@Api(tags = "福田标准法规--标准属性自定义")
@RequestMapping("/${restPath}/lawss/sarStandAttrDetails")
public class SarStandAttrDetailsController extends BaseController<SarStandAttrDetails> {
private static final Logger logger = LoggerFactory.getLogger(SarStandAttrDetailsController.class);
@Autowired
private ISarStandAttrDetailsService sarStandAttrDetailsEOService;
@ApiOperation(value = "|SarStandAttrDetailsEO|分页查询")
@GetMapping("/page")
// @RequiresPermissions("lawss:sarStandAttrDetails:page")
public ResponseMessage<PageInfo<SarStandAttrDetails>> page(SarStandAttrDetailsEOPage page) throws Exception {
List<SarStandAttrDetails> rows = sarStandAttrDetailsEOService.queryByPage(page);
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|SarStandAttrDetailsEO|查询")
@GetMapping("/list")
// @RequiresPermissions("lawss:sarStandAttrDetails:list")
@@ -51,4 +71,77 @@ public class SarStandAttrDetailsController extends BaseController<SarStandAttrDe
resultMap.put(SarTypeEnum.BUSS.getValue(),getBussList);
return Result.success(resultMap);
}
@ApiOperation(value = "|SarStandAttrDetailsEO|详情")
@GetMapping("/getStandAttrDetailsById")
// @RequiresPermissions("lawss:sarStandAttrDetails:get")
public ResponseMessage<SarStandAttrDetails> find(@PathVariable String id) throws Exception {
return Result.success(sarStandAttrDetailsEOService.getById(id));
}
@ApiOperation(value = "|SarStandAttrDetailsEO|新增")
@PostMapping("/createStandAttrDetails")
// @RequiresPermissions("lawss:sarStandAttrDetails:save")
public ResponseMessage<SarStandAttrDetails> create(@RequestBody SarStandAttrDetails sarStandAttrDetailsEO) throws Exception {
String resultMsg = sarStandAttrDetailsEOService.createStandAttrDetails(sarStandAttrDetailsEO);
if ("success".equals(resultMsg)) {
// 重新加载数据
// sarStandAttrDetailsEOService.getAttrDetails();
return Result.success("0","新增成功",sarStandAttrDetailsEO);
} else {
return Result.error("0","新增失败,"+resultMsg);
}
}
@ApiOperation(value = "|SarStandAttrDetailsEO|修改")
@PutMapping("/updateStandAttrDetails")
// @RequiresPermissions("lawss:sarStandAttrDetails:update")
public ResponseMessage<SarStandAttrDetails> update(@RequestBody SarStandAttrDetails sarStandAttrDetailsEO) throws Exception {
String resultMsg = sarStandAttrDetailsEOService.updateStandAttrDetails(sarStandAttrDetailsEO);
if ("success".equals(resultMsg)) {
// 重新加载数据
sarStandAttrDetailsEOService.getAttrDetails();
return Result.success("0","修改成功",sarStandAttrDetailsEO);
} else {
return Result.error("0","修改失败,"+resultMsg);
}
}
@ApiOperation(value = "|SarStandAttrDetailsEO|删除")
@DeleteMapping("/deleteAttrDetailsByIds")
// @RequiresPermissions("lawss:sarStandAttrDetails:delete")
public ResponseMessage delete(@PathVariable String id) throws Exception {
sarStandAttrDetailsEOService.removeById(id);
logger.info("delete from SAR_STAND_ATTR_DETAILS where id = {}", id);
return Result.success();
}
@ApiOperation(value = "|SarStandAttrDetailsEO|批量删除")
@PutMapping("/deleteByIds")
// @RequiresPermissions("lawss:sarStandAttrDetails:update")
public ResponseMessage deleteByIds(String ids,String sarType) throws Exception {
String resultMsg = sarStandAttrDetailsEOService.deleteByIds(ids,sarType);
if ("success".equals(resultMsg)) {
// 重新加载数据
sarStandAttrDetailsEOService.getAttrDetails();
return Result.success("0","删除成功",null);
} else {
return Result.error("0","删除失败");
}
}
@ApiOperation(value = "|SarStandAttrDetailsEO|查询标准中所有文件类型")
@GetMapping("/getFileFieldForSel")
// @RequiresPermissions("lawss:sarStandAttrDetails:get")
public ResponseMessage<List<SelectionResult>> getFileFieldForSel(){
return Result.success(sarStandAttrDetailsEOService.selectFileFieldForSel(null));
}
// 标准拆分使用
@ApiOperation(value = "|SarStandAttrDetailsEO|查询标准中所有文件类型")
@GetMapping("/getFileFieldForSel1")
// @RequiresPermissions("lawss:sarStandAttrDetails:get")
public ResponseMessage<List<SelectionResult>> selectFileFieldForSel1(){
return Result.success(sarStandAttrDetailsEOService.selectFileFieldForSel1(null));
}
}
@@ -1,9 +1,14 @@
package com.adc.da.slrs.sarStandAttrDetails.dao;
import com.adc.da.slrs.sarStandAttrDetails.entity.SarStandAttrDetails;
import com.adc.da.slrs.sarStandAttrDetails.page.SarStandAttrDetailsEOPage;
import com.adc.da.sys.common.SelectionResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
@@ -14,6 +19,20 @@ import org.apache.ibatis.annotations.Param;
*/
public interface SarStandAttrDetailsDao extends BaseMapper<SarStandAttrDetails> {
List<SarStandAttrDetails> queryByPage(SarStandAttrDetailsEOPage page);
List<SarStandAttrDetails> queryByList(SarStandAttrDetailsEOPage page);
Integer queryByCount(SarStandAttrDetailsEOPage page);
int deleteByIds(@Param("idList") List<String> idList);
String selectAllFieldToStr(SarStandAttrDetailsEOPage page);
List<SelectionResult> selectFileFieldForSel(@Param("attrField") String attrField);
List<SelectionResult> selectFileFieldForSel1(@Param("attrField") String attrField);
String selectNameByField(@Param("attrField") String attrField, @Param("sarType") String sarType);
SarStandAttrDetails selectFieldByName(@Param("attrName") String attrName, @Param("sarType") String sarType);
@@ -1,8 +1,12 @@
package com.adc.da.slrs.sarStandAttrDetails.service;
import com.adc.da.slrs.sarStandAttrDetails.entity.SarStandAttrDetails;
import com.adc.da.slrs.sarStandAttrDetails.page.SarStandAttrDetailsEOPage;
import com.adc.da.sys.common.SelectionResult;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
@@ -13,4 +17,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISarStandAttrDetailsService extends IService<SarStandAttrDetails> {
List<SarStandAttrDetails> queryByPage(SarStandAttrDetailsEOPage page);
String createStandAttrDetails (SarStandAttrDetails sarStandAttrDetailsEO);
String updateStandAttrDetails (SarStandAttrDetails sarStandAttrDetailsEO);
String deleteByIds (String ids,String sarType);
void getAttrDetails();
List<SelectionResult> selectFileFieldForSel(String attrField);
List<SelectionResult> selectFileFieldForSel1(String attrField);
}
@@ -1,11 +1,28 @@
package com.adc.da.slrs.sarStandAttrDetails.service.impl;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.common.StandAttrTypeEnum;
import com.adc.da.slrs.sarLawsAttrInfo.dao.SarLawsAttrInfoDao;
import com.adc.da.slrs.sarLawsInfo.dao.SarLawsInfoDao;
import com.adc.da.slrs.sarStandAttrDetails.entity.SarStandAttrDetails;
import com.adc.da.slrs.sarStandAttrDetails.dao.SarStandAttrDetailsDao;
import com.adc.da.slrs.sarStandAttrDetails.page.SarStandAttrDetailsEOPage;
import com.adc.da.slrs.sarStandAttrDetails.service.ISarStandAttrDetailsService;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.sys.common.SelectionResult;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* <p>
* 服务实现类
@@ -17,4 +34,446 @@ import org.springframework.stereotype.Service;
@Service
public class SarStandAttrDetailsServiceImpl extends ServiceImpl<SarStandAttrDetailsDao, SarStandAttrDetails> implements ISarStandAttrDetailsService {
private static final Logger logger = LoggerFactory.getLogger(ISarStandAttrDetailsService.class);
@Autowired
private SarStandAttrDetailsDao dao;
@Autowired
private SarLawsAttrInfoDao sarLawsAttrInfoDao;
@Autowired
private SarLawsInfoDao sarLawsInfoEODao;
@Autowired
private SarStandardsInfoDao sarStandardsInfoDao;
@Autowired
private SarStandAttrInfoDao sarStandAttrInfoEODao;
// @Autowired
// private SarBussionessStandDao sarBussionessStandEODao;
private final static List<String> standTypeList = new ArrayList<>();
private final static List<String> lawsTypeList = new ArrayList<>();
static {
standTypeList.add(SarTypeEnum.STAND.getValue());
standTypeList.add(SarTypeEnum.INLAND_STAND.getValue());
standTypeList.add(SarTypeEnum.FOREIGN_STAND.getValue());
lawsTypeList.add(SarTypeEnum.LAWS.getValue());
lawsTypeList.add(SarTypeEnum.INLAND_LAWS.getValue());
lawsTypeList.add(SarTypeEnum.FOREIGN_LAWS.getValue());
}
@Override
public List<SarStandAttrDetails> queryByPage(SarStandAttrDetailsEOPage page){
return dao.queryByPage(page);
}
/***
* @Description:
* @Author: yangxuenan
* @Date: 2020/8/17 15:44
* @Param: [sarStandAttrDetailsEO]
* @Return: void
*/
public String createStandAttrDetails (SarStandAttrDetails sarStandAttrDetailsEO) {
//向属性表增加字段
String fieldInfo = "";
String attrType = sarStandAttrDetailsEO.getAttrType();
String sarType = sarStandAttrDetailsEO.getSarType();
String attrField = sarStandAttrDetailsEO.getAttrField();
Long attrLen = sarStandAttrDetailsEO.getAttrLen();
String validMsg = validAttrInfo(sarStandAttrDetailsEO);
if (StringUtils.isNotBlank(validMsg)) {
return validMsg;
}
// 根据不同字段类型拼接sql参数
if (StandAttrTypeEnum.INPUT_STR.getValue().equals(attrType) || StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType) || StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
fieldInfo = attrField + " varchar(" + String.valueOf(attrLen) + ")";
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
fieldInfo = attrField + " int(" + String.valueOf(attrLen) + ")";
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
fieldInfo = attrField + " datetime";
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
fieldInfo = attrField + " varchar(500)";
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && attrLen < 4000) {
fieldInfo = attrField + " varchar(" + String.valueOf(attrLen) + ")";
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && attrLen >= 4000) {
fieldInfo = attrField + " text";
}
if (StringUtils.isNotBlank(fieldInfo)) {
if (standTypeList.contains(sarType)) {
sarStandAttrInfoEODao.alterStandAttr(fieldInfo);
} else if (lawsTypeList.contains(sarType)) {
sarLawsAttrInfoDao.alterLawsAttr(fieldInfo);
} else if (SarTypeEnum.BUSS.getValue().equals(sarType)) {
// dao.alterStandAttr(fieldInfo);
}
}
//向属性详细信息表添加数据
sarStandAttrDetailsEO.setId(UUIDUtils.randomUUID20());
sarStandAttrDetailsEO.setIsEdit("0");
sarStandAttrDetailsEO.setCreationUser(LoginUserUtil.getUserId());
sarStandAttrDetailsEO.setValidFlag("0");
sarStandAttrDetailsEO.setCreationTime(new Date());
sarStandAttrDetailsEO.setModifyTime(new Date());
int successCount = dao.insert(sarStandAttrDetailsEO);
if (successCount > 0) {
return "success";
} else {
return "error";
}
}
/***
* @Description: 验证属性信息
* @Author: yangxuenan
* @Date: 2020/8/18 10:39
* @Param: [sarStandAttrDetailsEO]
* @Return: java.lang.String
*/
public String validAttrInfo (SarStandAttrDetails sarStandAttrDetailsEO) {
String attrFfield = sarStandAttrDetailsEO.getAttrField();
String sarType = sarStandAttrDetailsEO.getSarType();
// 判断新增字段在属性表中是否已存在
SarStandAttrDetailsEOPage detailsEOPage = new SarStandAttrDetailsEOPage();
detailsEOPage.setAttrField(attrFfield);
detailsEOPage.setSarType(sarType);
int countFiled = dao.queryByCount(detailsEOPage);
if (countFiled > 0) {
return "属性字段已存在";
}
// 判断新增字段在基础表中是否已存在
Integer count = 0;
if (standTypeList.contains(sarType)) {
count = sarStandardsInfoDao.selectStandColumn(attrFfield);
} else if (lawsTypeList.contains(sarType)) {
count = sarLawsInfoEODao.selectLawsColumn(attrFfield);
} else if (SarTypeEnum.BUSS.getValue().equals(sarType)) {
// count = sarBussionessStandEODao.selectStandColumn(attrFfield);
}
if (count > 0) {
return "属性字段在基础表SAR_STANDARDS_INFO中已存在";
}
// 判断新增字段在属性表中是否已存在
Integer countAtt = 0;
if (standTypeList.contains(sarType)) {
countAtt = sarStandAttrInfoEODao.selectStandAttrColumn(attrFfield);
} else if (lawsTypeList.contains(sarType)) {
countAtt = sarLawsAttrInfoDao.selectLawsAttrColumn(attrFfield);
}
if (countAtt > 0) {
return "属性字段在属性表SAR_STAND_ATTR_INFO中已存在";
}
// 判断属性名称是否已存在
detailsEOPage.setAttrField(null);
detailsEOPage.setAttrName(sarStandAttrDetailsEO.getAttrName());
detailsEOPage.setSarType(sarType);
int countName = dao.queryByCount(detailsEOPage);
if (countName > 0) {
return "属性名称已存在";
}
return "";
}
public void getAttrDetails(){
String queryField = ""; //所有属性表需要查询的字段以逗号分隔
String queryFieldNames = ""; //所有属性表需要查询的字段名以逗号分隔
List<String> queryFieldList = new ArrayList<>(); //所有属性表需要查询的字段
List<String> selectionFieldList = new ArrayList<>(); // 属性表下拉选项类型字段
List<String> fileFieldList = new ArrayList<>(); // 属性表文件类型字段
List<String> clobFieldList = new ArrayList<>(); // 属性表clob类型字段
List<String> timeFieldList = new ArrayList<>(); // 属性表日期类型字段
List<String> multiTimeFieldList = new ArrayList<>(); // 属性表多个日期类型字段
List<String> numFieldList = new ArrayList<>(); // 属性表数字类型字段
List<SarStandAttrDetails> standInlandAttrFieldList = new ArrayList<>(); // 属性表数字类型字段
List<SarStandAttrDetails> standForeignAttrFieldList = new ArrayList<>();
Map<String,String> selectFieldMap = new HashMap<>(); // 下拉属性字段及选项值
// 政策属性字段信息
String queryFieldLaws = ""; //所有属性表需要查询的字段以逗号分隔
String queryFieldNamesLaws = ""; //所有属性表需要查询的字段名以逗号分隔
List<String> queryFieldListLaws = new ArrayList<>(); //所有属性表需要查询的字段
List<String> selectionFieldListLaws = new ArrayList<>(); // 属性表下拉选项类型字段
List<String> fileFieldListLaws = new ArrayList<>(); // 属性表文件类型字段
List<String> clobFieldListLaws = new ArrayList<>(); // 属性表clob类型字段
List<String> timeFieldListLaws = new ArrayList<>(); // 属性表日期类型字段
List<String> multiTimeFieldListLaws = new ArrayList<>(); // 属性表多个日期类型字段
List<String> numFieldListLaws = new ArrayList<>(); // 属性表数字类型字段
List<SarStandAttrDetails> lawsInlandAttrFieldList = new ArrayList<>(); // 属性表数字类型字段
List<SarStandAttrDetails> lawsForeignAttrFieldList = new ArrayList<>();
Map<String,String> selectFieldMapLaws = new HashMap<>(); // 下拉属性字段及选项值
// 企标属性字段信息
String queryFieldBuss = ""; //所有属性表需要查询的字段以逗号分隔
String queryFieldNamesBuss = ""; //所有属性表需要查询的字段名以逗号分隔
List<String> queryFieldListBuss = new ArrayList<>(); //所有属性表需要查询的字段
List<String> selectionFieldListBuss = new ArrayList<>(); // 属性表下拉选项类型字段
List<String> fileFieldListBuss = new ArrayList<>(); // 属性表文件类型字段
List<String> clobFieldListBuss = new ArrayList<>(); // 属性表clob类型字段
List<String> timeFieldListBuss = new ArrayList<>(); // 属性表日期类型字段
List<String> multiTimeFieldListBuss = new ArrayList<>(); // 属性表多个日期类型字段
List<String> numFieldListBuss = new ArrayList<>(); // 属性表数字类型字段
List<SarStandAttrDetails> bussAttrFieldList = new ArrayList<>(); // 属性表数字类型字段
Map<String,String> selectFieldMapBuss = new HashMap<>(); // 下拉属性字段及选项值
logger.info("新增编辑时加载--查询标准属性类!");
// 属性表需要查询的字段
StringBuilder fieldInfoBuilder = new StringBuilder();
StringBuilder fieldInfoBuilderLaws = new StringBuilder();
StringBuilder fieldInfoNameBuilder = new StringBuilder();
StringBuilder fieldInfoNameBuilderLaws = new StringBuilder();
StringBuilder fieldInfoBuilderBuss = new StringBuilder();
StringBuilder fieldInfoNameBuilderBuss = new StringBuilder();
SarStandAttrDetailsEOPage detailsEOPage = new SarStandAttrDetailsEOPage();
List<SarStandAttrDetails> getDetailsList = dao.queryByList(detailsEOPage);
if (getDetailsList != null && !getDetailsList.isEmpty()) {
logger.info("新增编辑时加载--查询标准属性类--查询到" + getDetailsList.size() + "条属性字段数据!");
for (SarStandAttrDetails detailsEO : getDetailsList) {
String sarType = detailsEO.getSarType();
String attrType = detailsEO.getAttrType();
if (standTypeList.contains(sarType)) {
if (!SarTypeEnum.FOREIGN_STAND.getValue().equals(sarType)) {
standInlandAttrFieldList.add(detailsEO);
}
if (!SarTypeEnum.INLAND_STAND.getValue().equals(sarType)) {
standForeignAttrFieldList.add(detailsEO);
}
fieldInfoBuilder.append(detailsEO.getAttrField() + ",");
fieldInfoNameBuilder.append(detailsEO.getAttrName() + ",");
queryFieldList.add(detailsEO.getAttrField());
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
selectionFieldList.add(detailsEO.getAttrField());
selectFieldMap.put(detailsEO.getAttrField(),detailsEO.getSelVal());
} else if (StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
fileFieldList.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && detailsEO.getAttrLen() >= 4000) {
clobFieldList.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
timeFieldList.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
multiTimeFieldList.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
numFieldList.add(detailsEO.getAttrField());
}
} else if (lawsTypeList.contains(sarType)) {
if (!SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
lawsInlandAttrFieldList.add(detailsEO);
}
if (!SarTypeEnum.INLAND_LAWS.getValue().equals(sarType)) {
lawsForeignAttrFieldList.add(detailsEO);
}
fieldInfoBuilderLaws.append(detailsEO.getAttrField() + ",");
fieldInfoNameBuilderLaws.append(detailsEO.getAttrName() + ",");
queryFieldListLaws.add(detailsEO.getAttrField());
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
selectionFieldListLaws.add(detailsEO.getAttrField());
selectFieldMapLaws.put(detailsEO.getAttrField(),detailsEO.getSelVal());
} else if (StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
fileFieldListLaws.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && detailsEO.getAttrLen() >= 4000) {
clobFieldListLaws.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
timeFieldListLaws.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
multiTimeFieldListLaws.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
numFieldListLaws.add(detailsEO.getAttrField());
}
} else if (SarTypeEnum.BUSS.getValue().equals(sarType)) {
bussAttrFieldList.add(detailsEO);
fieldInfoBuilderBuss.append(detailsEO.getAttrField() + ",");
fieldInfoNameBuilderBuss.append(detailsEO.getAttrName() + ",");
queryFieldListBuss.add(detailsEO.getAttrField());
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
selectionFieldListBuss.add(detailsEO.getAttrField());
selectFieldMapBuss.put(detailsEO.getAttrField(),detailsEO.getSelVal());
} else if (StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
fileFieldListBuss.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && detailsEO.getAttrLen() >= 4000) {
clobFieldListBuss.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
timeFieldListBuss.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
multiTimeFieldListBuss.add(detailsEO.getAttrField());
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
numFieldListBuss.add(detailsEO.getAttrField());
}
}
}
queryField = fieldInfoBuilder.toString();
queryFieldLaws = fieldInfoBuilderLaws.toString();
queryFieldBuss = fieldInfoBuilderBuss.toString();
if (StringUtils.isNotBlank(queryField)) {
queryField = queryField.substring(0,queryField.length()-1);
}
if (StringUtils.isNotBlank(queryFieldLaws)) {
queryFieldLaws = queryFieldLaws.substring(0,queryFieldLaws.length()-1);
}
if (StringUtils.isNotBlank(queryFieldBuss)) {
queryFieldBuss = queryFieldBuss.substring(0,queryFieldBuss.length()-1);
}
logger.info("新增编辑时加载--查询标准属性类--查询到属性字段为:" + queryField);
logger.info("新增编辑时加载--查询政策属性类--查询到属性字段为:" + queryFieldLaws);
logger.info("新增编辑时加载--查询企标属性类--查询到属性字段为:" + queryFieldBuss);
queryFieldNames = fieldInfoNameBuilder.toString();
queryFieldNamesLaws = fieldInfoNameBuilderLaws.toString();
queryFieldNamesBuss = fieldInfoNameBuilderBuss.toString();
if (StringUtils.isNotBlank(queryFieldNames)) {
queryFieldNames = queryFieldNames.substring(0,queryFieldNames.length()-1);
}
if (StringUtils.isNotBlank(queryFieldNamesLaws)) {
queryFieldNamesLaws = queryFieldNamesLaws.substring(0,queryFieldNamesLaws.length()-1);
}
if (StringUtils.isNotBlank(queryFieldNamesBuss)) {
queryFieldNamesBuss = queryFieldNamesBuss.substring(0,queryFieldNamesBuss.length()-1);
}
} else {
logger.error("新增编辑时加载--查询标准属性类--未查询到属性字段数据!");
}
InitStandAttrUtil.queryField = queryField; //所有属性表需要查询的字段以逗号分隔
InitStandAttrUtil. queryFieldNames = queryFieldNames; //所有属性表需要查询的字段名以逗号分隔
InitStandAttrUtil.queryFieldList = queryFieldList; //所有属性表需要查询的字段
InitStandAttrUtil.selectionFieldList = selectionFieldList; // 属性表下拉选项类型字段
InitStandAttrUtil.fileFieldList = fileFieldList; // 属性表文件类型字段
InitStandAttrUtil.clobFieldList = clobFieldList; // 属性表clob类型字段
InitStandAttrUtil.timeFieldList = timeFieldList; // 属性表日期类型字段
InitStandAttrUtil.multiTimeFieldList = multiTimeFieldList; // 属性表日期类型字段
InitStandAttrUtil.numFieldList = numFieldList; // 属性表数字类型字段
InitStandAttrUtil.standInlandAttrFieldList = standInlandAttrFieldList;
InitStandAttrUtil.standForeignAttrFieldList = standForeignAttrFieldList;
InitStandAttrUtil.selectFieldMap = selectFieldMap;
// 政策属性字段信息
InitStandAttrUtil.queryFieldLaws = queryFieldLaws; //所有属性表需要查询的字段以逗号分隔
InitStandAttrUtil.queryFieldNamesLaws = queryFieldNamesLaws; //所有属性表需要查询的字段名以逗号分隔
InitStandAttrUtil.queryFieldListLaws = queryFieldListLaws; //所有属性表需要查询的字段
InitStandAttrUtil.selectionFieldListLaws = selectionFieldListLaws; // 属性表下拉选项类型字段
InitStandAttrUtil.fileFieldListLaws = fileFieldListLaws; // 属性表文件类型字段
InitStandAttrUtil.clobFieldListLaws = clobFieldListLaws; // 属性表clob类型字段
InitStandAttrUtil.timeFieldListLaws = timeFieldListLaws; // 属性表日期类型字段
InitStandAttrUtil.multiTimeFieldListLaws = multiTimeFieldListLaws; // 属性表日期类型字段
InitStandAttrUtil.numFieldListLaws = numFieldListLaws; // 属性表数字类型字段
InitStandAttrUtil.lawsInlandAttrFieldList = lawsInlandAttrFieldList;
InitStandAttrUtil.lawsForeignAttrFieldList = lawsForeignAttrFieldList;
InitStandAttrUtil.selectFieldMapLaws = selectFieldMapLaws;
// 企标属性字段信息
InitStandAttrUtil.queryFieldBuss = queryFieldBuss; //所有属性表需要查询的字段以逗号分隔
InitStandAttrUtil.queryFieldNamesBuss = queryFieldNamesBuss; //所有属性表需要查询的字段名以逗号分隔
InitStandAttrUtil.queryFieldListBuss = queryFieldListBuss; //所有属性表需要查询的字段
InitStandAttrUtil.selectionFieldListBuss = selectionFieldListBuss; // 属性表下拉选项类型字段
InitStandAttrUtil.fileFieldListBuss = fileFieldListBuss; // 属性表文件类型字段
InitStandAttrUtil.clobFieldListBuss = clobFieldListBuss; // 属性表clob类型字段
InitStandAttrUtil.timeFieldListBuss = timeFieldListBuss; // 属性表日期类型字段
InitStandAttrUtil.multiTimeFieldListBuss = multiTimeFieldListBuss; // 属性表日期类型字段
InitStandAttrUtil.numFieldListBuss = numFieldListBuss; // 属性表数字类型字段
InitStandAttrUtil.bussAttrFieldList = bussAttrFieldList;
InitStandAttrUtil.selectFieldMapBuss = selectFieldMapBuss;
}
/***
* @Description: 修改字段属性
* @Author: yangxuenan
* @Date: 2020/8/18 9:19
* @Param: []
* @Return: void
*/
public String updateStandAttrDetails (SarStandAttrDetails sarStandAttrDetailsEO) {
// 查询修改数据原信息
SarStandAttrDetails oldDetails = dao.selectById(sarStandAttrDetailsEO.getId());
//验证属性名称是否已存在
SarStandAttrDetailsEOPage detailsEOPage = new SarStandAttrDetailsEOPage();
detailsEOPage.setNotId(sarStandAttrDetailsEO.getId());
detailsEOPage.setAttrField(null);
detailsEOPage.setSarType(sarStandAttrDetailsEO.getSarType());
detailsEOPage.setAttrName(sarStandAttrDetailsEO.getAttrName());
int countName = dao.queryByCount(detailsEOPage);
if (countName > 0) {
return "属性名称已存在";
}
// 修改属性表字段(当前仅允许修改长度)
Long oldLen = oldDetails.getAttrLen();
Long newLen = sarStandAttrDetailsEO.getAttrLen();
if (oldLen > newLen) {
return "修改字段长度不能小于原长度";
} else if (oldLen < newLen) {
String fieldInfo = "";
String attrType = sarStandAttrDetailsEO.getAttrType();
String sarType = sarStandAttrDetailsEO.getSarType();
String attrField = sarStandAttrDetailsEO.getAttrField();
// if (StandAttrTypeEnum.INPUT_STR.getValue().equals(attrType) || StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType) || StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
// fieldInfo = "(" + attrField + " VARCHAR2(" + String.valueOf(newLen) + " char))";
// } else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
// fieldInfo = "(" + attrField + " NUMBER(" + String.valueOf(newLen) + "))";
// } else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
// fieldInfo = "(" + attrField + " DATE)";
// } else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType)) {
// fieldInfo = "(" + attrField + " CLOB(" + String.valueOf(newLen) + "))";
// }
// if (standTypeList.contains(sarType)) {
// sarStandAttrInfoEOService.updateAttrLen(fieldInfo);
// } else if (lawsTypeList.contains(sarType)) {
// sarLawsAttrInfoEOService.updateAttrLen(fieldInfo);
// } else if (SarTypeEnum.BUSS.getValue().equals(sarType)) {
// sarBussStandAttrInfoEOService.updateAttrLen(fieldInfo);
// }
}
// 修改属性详细信息表
sarStandAttrDetailsEO.setModifyTime(new Date());
int countSuc = dao.updateById(sarStandAttrDetailsEO);
if (countSuc > 0) {
return "success";
} else {
return "error";
}
}
/***
* @Description: 删除字段属性
* @Author: yangxuenan
* @Date: 2020/8/18 9:19
* @Param: [ids]
* @Return: java.lang.String
*/
public String deleteByIds (String ids,String sarType) {
String resultMsg = "";
//查询所有字段名
String[] idArr = ids.split(",");
SarStandAttrDetailsEOPage page = new SarStandAttrDetailsEOPage();
page.setIdList(idArr);
List<SarStandAttrDetails> getList = dao.queryByList(page);
if (getList != null && !getList.isEmpty()) {
String columnNames = "";
for (SarStandAttrDetails detailsEO : getList) {
columnNames += detailsEO.getAttrField() + ",";
}
columnNames = " " + columnNames.substring(0,columnNames.length()-1) + " ";
//删除属性表字段 sarLawsAttrInfoDao.alterLawsAttr(fieldInfo);
if (standTypeList.contains(sarType)) {
sarStandAttrInfoEODao.deleteStandAttr(columnNames);
} else if (lawsTypeList.contains(sarType)) {
sarLawsAttrInfoDao.deleteLawsAttr(columnNames);
} else if (SarTypeEnum.BUSS.getValue().equals(sarType)) {
// sarBussStandAttrInfoEOService.deleteStandAttr(columnNames);
}
}
//删除属性信息详情表数据
List<String> idList = Arrays.asList(idArr);
int countSuc = dao.deleteBatchIds(idList);
if (countSuc > 0) {
return "success";
} else {
return "error";
}
}
public List<SelectionResult> selectFileFieldForSel(String attrField){
return dao.selectFileFieldForSel(attrField);
}
public List<SelectionResult> selectFileFieldForSel1(String attrField){
return dao.selectFileFieldForSel1(attrField);
}
}
@@ -2,6 +2,8 @@ package com.adc.da.slrs.sarStandAttrInfo.entity;
import com.adc.da.base.entity.BaseEntity;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -42,33 +44,40 @@ public class SarStandAttrInfo extends BaseEntity {
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
private LocalDateTime creationTime;
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
private LocalDateTime modifyTime;
private Date modifyTime;
@ApiModelProperty(value = "归口管理部门")
@TableField("GKDW")
private String gkdw;
@ApiModelProperty(value = "起草单位")
@TableField("FBJG")
private String fbjg;
@ApiModelProperty(value = "我司参与深度")
@TableField("CYSD")
private String cysd;
@ApiModelProperty(value = "新车型实施日期(标准文本)")
@TableField("XCXSSRQ")
private String xcxssrq;
@ApiModelProperty(value = "在产车实施日期(标准文本)")
@TableField("ZCCSSRQ")
private String zccssrq;
@TableField("EOPSSRQ")
private String eopssrq;
@ApiModelProperty(value = "采标编号")
@TableField("CBBH")
private String cbbh;
@ApiModelProperty(value = "适用车辆")
@TableField("CLLX")
private String cllx;
@@ -93,45 +102,56 @@ public class SarStandAttrInfo extends BaseEntity {
@TableField("SVPPS")
private String svpps;
@ApiModelProperty(value = "草案")
@TableField("CA")
private String ca;
@ApiModelProperty(value = "征求意见稿")
@TableField("ZQYJG")
private String zqyjg;
@ApiModelProperty(value = "送审稿")
@TableField("SSG")
private String ssg;
@ApiModelProperty(value = "报批稿")
@TableField("BPG")
private String bpg;
@TableField("CGBM")
private String cgbm;
@ApiModelProperty(value = "发布稿")
@TableField("FBGBJBD")
private String fbgbjbd;
@TableField("ZBJBD")
private String zbjbd;
@ApiModelProperty(value = "责任部门")
@TableField("ZRBM")
private String zrbm;
@TableField("FGWHR")
private String fgwhr;
@ApiModelProperty(value = "代替标准编号")
@TableField("DTBJH")
private String dtbjh;
@ApiModelProperty(value = "引用标准")
@TableField("YYBJ")
private String yybj;
@ApiModelProperty(value = "被引用标准")
@TableField("BYYBJ")
private String byybj;
@ApiModelProperty(value = "相关流程")
@TableField("XGLC")
private String xglc;
@ApiModelProperty(value = "参会记录")
@TableField("CHJL")
private String chjl;
@@ -144,6 +164,7 @@ public class SarStandAttrInfo extends BaseEntity {
@TableField("EOPSSRQXM")
private String eopssrqxm;
@ApiModelProperty(value = "采标程度")
@TableField("CBCD")
private String cbcd;
@@ -168,5 +189,81 @@ public class SarStandAttrInfo extends BaseEntity {
@TableField("BDTBZBH")
private String bdtbzbh;
// 新添加字段 --start
@ApiModelProperty(value = "新车型实施日期(国际)")
@TableField("XCXSSRQGJ")
private String xcxssrqgj;
@ApiModelProperty(value = "在产车实施日期(国际)")
@TableField("ZCCSSRQGJ")
private String zccssrqgj;
@ApiModelProperty(value = "实施日期(标准文本)")
@TableField("SSRQ")
private String ssrq;
@ApiModelProperty(value = "实施日期(国际)")
@TableField("SSRQGJ")
private String ssrqgj;
@ApiModelProperty(value = "修改单")
@TableField("XGD")
private String xgd;
@ApiModelProperty(value = "解读文件")
@TableField("JDWJ")
private String jdwj;
@ApiModelProperty(value = "我司署名人")
@TableField("WSSMR")
private String wssmr;
@ApiModelProperty(value = "能源类型")
@TableField("NYLX")
private String nylx;
@ApiModelProperty(value = "适用产品线")
@TableField("SYCPX")
private String sycpx;
@ApiModelProperty(value = "适用认证")
@TableField("SYRZ")
private String syrz;
@ApiModelProperty(value = "责任工程师")
@TableField("ZRGCS")
private String zrgcs;
@ApiModelProperty(value = "乘用车VPPS编码")
@TableField("CYCVPPSBM")
private String cycvppsbm;
@ApiModelProperty(value = "乘用车VPPS中文名称")
@TableField("CYCVPPSCN")
private String cycvppscn;
@ApiModelProperty(value = "卡车VPPS编码")
@TableField("KCCVPPSBM")
private String kccvppsbm;
@ApiModelProperty(value = "卡车VPPS中文名称")
@TableField("KCCVPPSCN")
private String kccvppscn;
@ApiModelProperty(value = "模块结构单元变型号")
@TableField("DYBXH")
private String dybxh;
@ApiModelProperty(value = "模块结构单元名称")
@TableField("DYMC")
private String dymc;
@ApiModelProperty(value = "关联文件")
@TableField("GLWJ")
private String glwj;
// -- end
}
@@ -73,7 +73,7 @@ public class SarStandardsInfo extends BaseEntity {
@TableField("STAND_NATURE")
private String standNature;
@ApiModelProperty(value = "发布日期")
@ApiModelProperty(value = "标准发布日期")
@TableField("ISSUE_TIME")
private String issueTime;
@@ -111,10 +111,11 @@ public class SarStandardsInfo extends BaseEntity {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date modifyTime;
@ApiModelProperty(value = "是否法规清单相关(0否 1是)")
@ApiModelProperty(value = "是否纳入认证清单(0否 1是)")
@TableField("IS_RELATE_ACCESS")
private String isRelateAccess;
@ApiModelProperty(value = "引用标准")
@TableField("CITE_STAND")
private String citeStand;
@@ -123,6 +124,15 @@ public class SarStandardsInfo extends BaseEntity {
@TableField("CITED_STAND")
private String citedStand;
// 新添加字段
@ApiModelProperty(value = "文本状态")
@TableField("TEXT_STATUS")
private String textStatus;
@ApiModelProperty(value = "标准体系")
@TableField("STAND_SYSTEM")
private String standSystem;
// 以下为非表中字段
@TableField(exist = false)
@@ -164,8 +174,6 @@ public class SarStandardsInfo extends BaseEntity {
private String accessCountry;//纳入清单的国家
@TableField(exist = false)
private String processNum;//流程编号
@TableField(exist = false)
private String textStatus;//文本状态
// 在库里的标准节点类型(工作组)
@TableField(exist = false)
private String menuType;
@@ -54,10 +54,164 @@
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_LAWS_ATTR_INFO.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_LAWS_ATTR_INFO(<include refid="Base_Column_List" />)
values (#{id, jdbcType=VARCHAR}, #{lawsId, jdbcType=VARCHAR}, #{creationUser, jdbcType=VARCHAR}, #{validFlag, jdbcType=VARCHAR}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_LAWS_ATTR_INFO.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_LAWS_ATTR_INFO
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >id,</if>
<if test="lawsId != null" >laws_id,</if>
<if test="creationUser != null" >creation_user,</if>
<if test="validFlag != null" >valid_flag,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="modifyTime != null" >modify_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<if test="lawsId != null" >#{lawsId, jdbcType=VARCHAR},</if>
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
<if test="validFlag != null" >#{validFlag, jdbcType=VARCHAR},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<!-- 根据pk,修改记录-->
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo" >
update SAR_LAWS_ATTR_INFO
set laws_id = #{lawsId},
creation_user = #{creationUser},
valid_flag = #{validFlag},
creation_time = #{creationTime},
modify_time = #{modifyTime}
where id = #{id}
</update>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo" >
update SAR_LAWS_ATTR_INFO
<set >
<if test="lawsId != null" >
laws_id = #{lawsId},
</if>
<if test="creationUser != null" >
creation_user = #{creationUser},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 SAR_LAWS_ATTR_INFO -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_LAWS_ATTR_INFO
where id = #{value}
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_LAWS_ATTR_INFO
where id = #{value}
</delete>
<!-- SAR_LAWS_ATTR_INFO 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_LAWS_ATTR_INFO
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_LAWS_ATTR_INFO列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from SAR_LAWS_ATTR_INFO
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/> from SAR_LAWS_ATTR_INFO
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
<insert id="alterLawsAttr" parameterType="java.lang.String" >
alter table SAR_LAWS_ATTR_INFO
add ${fieldInfo}
</insert>
<!-- 删除字段-->
<insert id="deleteLawsAttr" parameterType="java.lang.String" >
alter table SAR_LAWS_ATTR_INFO
drop COLUMN ${fieldInfo}
</insert>
<!-- 查询表中已存在字段-->
<select id="selectLawsAttrColumn" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(*)
FROM information_schema.columns
WHERE TABLE_NAME = 'SAR_LAWS_ATTR_INFO' AND COLUMN_NAME = #{columnName}
</select>
<!-- 修改字段长度-->
<update id="updateAttrLen" parameterType="java.lang.String" >
ALTER table SAR_LAWS_ATTR_INFO
MODIFY ${fieldInfo}
</update>
<!-- 查询字段及对应数据-->
<select id="selectLawsFieldAndData" resultType="Map">
SELECT ${fieldInfo}
FROM SAR_LAWS_ATTR_INFO
WHERE valid_flag=0 and laws_id = #{standId}
</select>
<insert id="insertLawsAttr" parameterType="java.lang.String" >
insert into SAR_LAWS_ATTR_INFO(${fieldInfo})
values (${fieldValue})
</insert>
<update id="deleteLawsAttrByStandId" parameterType="java.lang.String" >
delete from SAR_LAWS_ATTR_INFO
where laws_id = #{standId}
</update>
<update id="updateLawsInfo" parameterType="java.lang.String" >
update SAR_LAWS_ATTR_INFO set ${field}=#{value}
where laws_id = #{lawsId}
</update>
<select id="selectFieldValByLawsId" resultType="java.lang.String" parameterType="java.lang.String">
SELECT ${field}
FROM SAR_LAWS_ATTR_INFO
WHERE laws_id = #{lawsId} and valid_flag=0
</select>
</mapper>
@@ -284,4 +284,11 @@
<include refid="Laws_Where_Clause"/>
GROUP BY SAR_LAWS_INFO.ID) a
</select>
<select id="selectLawsColumn" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_name = 'SAR_LAWS_INFO' AND column_name = #{columnName}
</select>
</mapper>
@@ -107,20 +107,57 @@
</trim>
</sql>
<select id="selectNameByField" resultType="java.lang.String" parameterType="java.lang.String">
SELECT attr_name
<!-- 根据id查询 SAR_STAND_ATTR_DETAILS -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_ATTR_DETAILS
where attr_field = #{attrField} and valid_flag=0
<if test='sarType != null and sarType == "INLAND_STAND"'>
and (sar_type=#{sarType} or sar_type='STAND')
</if>
<if test='sarType != null and sarType == "FOREIGN_STAND"'>
and (sar_type=#{sarType} or sar_type='STAND')
</if>
<if test='sarType != null and sarType != "FOREIGN_STAND" and sarType != "INLAND_STAND"'>
and sar_type=#{sarType}
</if>
limit 0,1
where id = #{value} and valid_flag=0
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_STAND_ATTR_DETAILS
where id = #{value} and valid_flag=0
</delete>
<!-- SAR_STAND_ATTR_DETAILS 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_STAND_ATTR_DETAILS
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_STAND_ATTR_DETAILS列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" />,areaName from
(select tmp_tb.* from
(select <include refid="Base_Column_List_Show" />,UT_AREA.area_name as areaName from SAR_STAND_ATTR_DETAILS
left join UT_AREA on SAR_STAND_ATTR_DETAILS.show_region_id = UT_AREA.id
<include refid="Base_Where_Clause"/>
order by SAR_STAND_ATTR_DETAILS.order_num,SAR_STAND_ATTR_DETAILS.id
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/> from SAR_STAND_ATTR_DETAILS
<include refid="Base_Where_Clause"/>
order by order_num,id
</select>
<update id="deleteByIds" parameterType="java.lang.String" >
delete from SAR_STAND_ATTR_DETAILS
where id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="selectAllFieldToStr" resultType="java.lang.String" parameterType="com.adc.da.base.page.BasePage">
SELECT listagg ( attr_field, ',' ) within GROUP ( ORDER BY attr_field )
from SAR_STAND_ATTR_DETAILS
<include refid="Base_Where_Clause"/>
order by order_num,id
</select>
<select id="selectFieldByName" resultMap="BaseResultMap" parameterType="java.lang.String">
@@ -139,4 +176,45 @@
limit 0,1
</select>
<select id="selectFileFieldForSel" resultType="com.adc.da.sys.common.SelectionResult" parameterType="java.lang.String">
SELECT attr_field as value, attr_name as label
from SAR_STAND_ATTR_DETAILS
where valid_flag=0 and attr_type='FILE' and
(sar_type='STAND' or sar_type='INLAND_STAND' or sar_type='FOREIGN_STAND')
<if test="attrField != null">
and attr_field=#{attrField}
</if>
group by attr_field,attr_name
</select>
<!-- 标准拆分在用-->
<select id="selectFileFieldForSel1" resultType="com.adc.da.sys.common.SelectionResult"
parameterType="java.lang.String">
SELECT attr_field as value, attr_name as label
from SAR_STAND_ATTR_DETAILS
where valid_flag=0 and attr_type='FILE' and
(sar_type='STAND' or sar_type='INLAND_STAND' or sar_type='FOREIGN_STAND' or SAR_TYPE = 'FOREIGN_LAWS')
<if test="attrField != null">
and attr_field=#{attrField}
</if>
group by attr_field,attr_name
</select>
<select id="selectNameByField" resultType="java.lang.String" parameterType="java.lang.String">
SELECT attr_name
from SAR_STAND_ATTR_DETAILS
where attr_field = #{attrField} and valid_flag=0
<if test='sarType != null and sarType == "INLAND_STAND"'>
and (sar_type=#{sarType} or sar_type='STAND')
</if>
<if test='sarType != null and sarType == "FOREIGN_STAND"'>
and (sar_type=#{sarType} or sar_type='STAND')
</if>
<if test='sarType != null and sarType != "FOREIGN_STAND" and sarType != "INLAND_STAND"'>
and sar_type=#{sarType}
</if>
limit 0,1
</select>
</mapper>
@@ -28,6 +28,8 @@
<result column="cite_stand" property="citeStand" />
<result column="cited_stand" property="citedStand" />
<result column="allPutTime" property="allPutTime" />
<result column="text_status" property="textStatus" />
<result column="stand_system" property="standSystem" />
</resultMap>
<resultMap id="BaseResultMapExcel" type="com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo">
@@ -50,7 +52,7 @@
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.synopsis, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,SAR_STANDARDS_INFO.is_relate_access,SAR_STANDARDS_INFO.cite_stand,SAR_STANDARDS_INFO.cited_stand
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,SAR_STANDARDS_INFO.is_relate_access,SAR_STANDARDS_INFO.cite_stand,SAR_STANDARDS_INFO.cited_stand,SAR_STANDARDS_INFO.text_status
</sql>
<sql id="Base_Column_List_Show" >
@@ -59,7 +61,7 @@
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
concat(SAR_STANDARDS_INFO.synopsis, '') as synopsis, concat(replace_stand_num, '') as replace_stand_num, replaced_stand_num, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,dicountry.DIC_TYPE_NAME as countryShow, dicstandSort.DIC_TYPE_NAME as standSortShow,
dicstandState.DIC_TYPE_NAME as standStateShow,dicstandNature.DIC_TYPE_NAME as standNatureShow,is_relate_access,cite_stand,cited_stand
dicstandState.DIC_TYPE_NAME as standStateShow,dicstandNature.DIC_TYPE_NAME as standNatureShow,is_relate_access,cite_stand,cited_stand,SAR_STANDARDS_INFO.text_status
</sql>
<sql id="Group_Column_List_Show">
@@ -68,7 +70,7 @@
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
concat(SAR_STANDARDS_INFO.synopsis, ''), concat(replace_stand_num, ''), replaced_stand_num, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,dicountry.DIC_TYPE_NAME, dicstandSort.DIC_TYPE_NAME,
dicstandState.DIC_TYPE_NAME,dicstandNature.DIC_TYPE_NAME,is_relate_access,cite_stand,cited_stand
dicstandState.DIC_TYPE_NAME,dicstandNature.DIC_TYPE_NAME,is_relate_access,cite_stand,cited_stand,SAR_STANDARDS_INFO.text_status
</sql>
<!-- 查询条件 -->
@@ -159,6 +161,12 @@
<if test="isRelateAccess != null" >
and is_relate_access = #{isRelateAccess}
</if>
<if test="textStatus != null" >
and text_status = #{textStatus}
</if>
<if test="standSystem != null" >
and stand_system = #{standSystem}
</if>
</trim>
</sql>
@@ -188,6 +196,8 @@
<if test="isRelateAccess != null" >is_relate_access,</if>
<if test="citeStand != null" >cite_stand,</if>
<if test="citedStand != null" >cited_stand,</if>
<if test="textStatus != null" >text_status,</if>
<if test="standSystem != null" >stand_system,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
@@ -212,6 +222,8 @@
<if test="isRelateAccess != null" >#{isRelateAccess, jdbcType=VARCHAR},</if>
<if test="citeStand != null" >#{citeStand, jdbcType=VARCHAR},</if>
<if test="citedStand != null" >#{citedStand, jdbcType=VARCHAR},</if>
<if test="textStatus != null" >#{textStatus, jdbcType=VARCHAR},</if>
<if test="standSystem != null" >#{standSystem, jdbcType=VARCHAR},</if>
</trim>
</insert>
@@ -235,7 +247,9 @@
creation_user = #{creationUser},
valid_flag = #{validFlag},
creation_time = #{creationTime},
modify_time = #{modifyTime}
modify_time = #{modifyTime},
text_status = #{textStatus},
stand_system = #{standSystem}
where id = #{id}
</update>
@@ -306,6 +320,12 @@
<if test="citedStand != null" >
cited_stand = #{citedStand},
</if>
<if test="textStatus != null" >
text_status = #{textStatus},
</if>
<if test="standSystem != null" >
stand_system = #{standSystem},
</if>
</set>
where id = #{id}
</update>