feat: 企标详情接口支持企标编号查询

This commit is contained in:
2023-09-21 10:52:25 +08:00
parent 5dab839c5c
commit b99c16430d
7 changed files with 21 additions and 14 deletions
@@ -53,7 +53,8 @@ public interface LawsCommonMapper {
**/ **/
Map<String, Object> getByIdAndModule(@org.apache.ibatis.annotations.Param("tableName") String tableName, Map<String, Object> getByIdAndModule(@org.apache.ibatis.annotations.Param("tableName") String tableName,
@org.apache.ibatis.annotations.Param("selectField") String selectField, @org.apache.ibatis.annotations.Param("selectField") String selectField,
@org.apache.ibatis.annotations.Param("id") String id); @org.apache.ibatis.annotations.Param("id") String id,
@org.apache.ibatis.annotations.Param("standardNumber") String standardNumber);
/** /**
@@ -18,7 +18,13 @@
</insert> </insert>
<select id="getByIdAndModule" resultType="java.util.Map"> <select id="getByIdAndModule" resultType="java.util.Map">
SELECT ${selectField} FROM ${tableName} WHERE id = #{id} SELECT ${selectField} FROM ${tableName} WHERE 1 = 1
<if test="id != null and id != ''">
AND id = #{id}
</if>
<if test="standardNumber != null and standardNumber != ''">
AND standard_number = #{standardNumber}
</if>
</select> </select>
<delete id="deleteByIdsAndModule"> <delete id="deleteByIdsAndModule">
@@ -87,7 +87,7 @@ public interface ILawsCommonService {
* @Date: 2023/8/24 11:49 * @Date: 2023/8/24 11:49
* @Description: 根据id和模块标识获取信息 * @Description: 根据id和模块标识获取信息
**/ **/
Map<String, Object> getByIdAndModule(String id, String module, String type); Map<String, Object> getByIdAndModule(String id, String module, String type, String standardNumber);
/** /**
* @Author: liao * @Author: liao
@@ -532,7 +532,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
String id = (String) parameterMap.get(FieldCommon.ID); String id = (String) parameterMap.get(FieldCommon.ID);
parameterMap.remove(FieldCommon.ID); parameterMap.remove(FieldCommon.ID);
// 获取数据库里没修改的数据 // 获取数据库里没修改的数据
Map<String, Object> oldDataMap = getByIdAndModule(id, module, "2"); Map<String, Object> oldDataMap = getByIdAndModule(id, module, "2", standardNumber);
// 组装更新内容 // 组装更新内容
StringBuilder recordBuffer = new StringBuilder(); StringBuilder recordBuffer = new StringBuilder();
@@ -720,9 +720,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
* @Description: 根据id和模块标识获取信息 * @Description: 根据id和模块标识获取信息
**/ **/
@Override @Override
public Map<String, Object> getByIdAndModule(String id, String module, String type) { public Map<String, Object> getByIdAndModule(String id, String module, String type, String standardNumber) {
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id) && StringUtils.isBlank(standardNumber)) {
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "id"); throw new JeroBootException(ResultCommon.EMPTY_COMMON, "id和标准号不能同时为空");
} }
// 获取要操作的表名 // 获取要操作的表名
String tableName = TableNameEnum.getTableName(module); String tableName = TableNameEnum.getTableName(module);
@@ -742,7 +742,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
// 封装查询显示的字段 // 封装查询显示的字段
String selectField = getSelectField(fieldList); String selectField = getSelectField(fieldList);
// 封装查询条件 // 封装查询条件
Map<String, Object> initMap = lawsCommonMapper.getByIdAndModule(tableName, selectField, id); Map<String, Object> initMap = lawsCommonMapper.getByIdAndModule(tableName, selectField, id, standardNumber);
if (initMap == null) { if (initMap == null) {
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND); throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
} }
@@ -97,7 +97,7 @@ public class LawsDomesticController {
@GetMapping(value = "getByIdAndModule") @GetMapping(value = "getByIdAndModule")
public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id") String id, public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id") String id,
@RequestParam(name="type") String type) { @RequestParam(name="type") String type) {
return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type)); return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type, null));
} }
@AutoLog(value = "国内法规标准-根据ids和模块标识删除信息") @AutoLog(value = "国内法规标准-根据ids和模块标识删除信息")
@@ -105,9 +105,10 @@ public class LawsEnterpriseController {
@AutoLog(value = "企业法规标准-根据id和模块标识获取信息") @AutoLog(value = "企业法规标准-根据id和模块标识获取信息")
@ApiOperation(value="企业法规标准-根据id和模块标识获取信息", notes="企业法规标准-根据id和模块标识获取信息") @ApiOperation(value="企业法规标准-根据id和模块标识获取信息", notes="企业法规标准-根据id和模块标识获取信息")
@GetMapping(value = "getByIdAndModule") @GetMapping(value = "getByIdAndModule")
public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id") String id, public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id", required = false) String id,
@RequestParam(name="type") String type) { @RequestParam(name="type") String type,
return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type)); @RequestParam(name="standardNumber", required = false) String standardNumber) {
return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type, standardNumber));
} }
@AutoLog(value = "企业法规标准-根据ids和模块标识删除信息") @AutoLog(value = "企业法规标准-根据ids和模块标识删除信息")
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* @Author: liao * @Author: liao
@@ -98,7 +97,7 @@ public class LawsOverseasController {
@GetMapping(value = "getByIdAndModule") @GetMapping(value = "getByIdAndModule")
public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id") String id, public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id") String id,
@RequestParam(name="type") String type) { @RequestParam(name="type") String type) {
return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type)); return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type, null));
} }
@AutoLog(value = "海外法规标准-根据ids和模块标识删除信息") @AutoLog(value = "海外法规标准-根据ids和模块标识删除信息")