Commit 27b6c432 authored by 韩桐桐's avatar 韩桐桐

fix(jg):1、使用登记列表查询sql精简;2、车用气瓶列表增加排序功能

parent 567ef88c
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgVehicleInformationDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgVehicleInformation;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -18,7 +19,10 @@ import java.util.Map;
public interface JgVehicleInformationMapper extends BaseMapper<JgVehicleInformation> {
@MapKey("roleIds")
Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page, @Param("dto") JgVehicleInformationDto dto , @Param("roleIds") List<String> roleIds);
Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page,
@Param("sort") SortVo sortMap,
@Param("dto") JgVehicleInformationDto dto ,
@Param("roleIds") List<String> roleIds);
@MapKey("sequenceNbr")
JgVehicleInformationDto queryBySequenceNbr(@Param("sequenceNbr") Long sequenceNbr);
......
......@@ -9,6 +9,7 @@
jet.use_unit_name AS useUnitName,
jet.apply_status AS applyStatus,
date_format(jet.apply_date,'%Y-%m-%d') as applyDate,
date_format(jet.accept_date,'%Y-%m-%d') AS acceptDate,
jet.install_unit_credit_code AS installUnitCreditCode,
jet.equip_num AS equipNum,
jet.install_unit_name AS installUnitName,
......@@ -17,7 +18,6 @@
jet.next_execute_ids AS nextExecuteIds,
jet.execute_sequence AS executeSequence,
jet.instance_status AS instanceStatus,
jet.accept_date AS acceptDate,
jet.task_name AS taskName,
ri.PRODUCT_NAME AS productName,
ri.BRAND_NAME AS brandName,
......
......@@ -50,10 +50,7 @@
</sql>
<select id="getListPage" resultType="java.util.Map">
select
*
from
(<include refid="page-list"/>
<include refid="page-list"/>
<where>
ur.is_delete = 0
<if test="dto.equList != null and dto.equList != ''">
......@@ -92,16 +89,16 @@
AND ur.receive_company_code = #{dto.receiveCompanyCode}
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
and ur.use_unit_name like concat('%',#{dto.useUnitName},'%')
and ur.use_unit_name like concat('%',#{dto.useUnitName},'%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and ur.apply_no like concat('%',#{dto.applyNo},'%')
and ur.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and ur.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
and ur.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and ur.use_unit_credit_code = #{dto.useUnitCode}
and ur.use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="roleIds != null and dto.dataType == 'supervision'">
<foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>
......@@ -109,73 +106,21 @@
</foreach>
</if>
<if test="dto.dataType == 'supervision' ">
AND ur.receive_company_code = #{dto.receiveCompanyCode}
AND ur.instance_id <![CDATA[<>]]> ''
AND (ur.receive_company_code = #{dto.receiveCompanyCode} or ur.transfer_to_user_ids LIKE concat ('%',
#{dto.currentUserId}, '%'))
AND ur.instance_id <![CDATA[<>]]> ''
</if>
<if test="dto.dataType == 'company' ">
and ur.use_unit_credit_code = #{dto.unitCode}
AND (ur.use_unit_credit_code = #{dto.unitCode} or ur.transfer_to_user_ids LIKE concat ('%',
#{dto.currentUserId}, '%'))
</if>
GROUP BY re.equip_transfer_id
</where>
union
<include refid="page-list"/>
<where>
ur.is_delete = 0
and ur.transfer_to_user_ids LIKE concat ('%', #{dto.currentUserId}, '%')
<if test="dto.equList != null and dto.equList != ''">
and jri. EQU_LIST= #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
and jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
and jri.EQU_DEFINE = #{dto.equDefine}
</if>
<if test="dto.status != null and dto.status != ''">
and ur.status = #{dto.status}
</if>
<if test="dto.applicationDate != null">
and ur.reg_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.equCode != null and dto.equCode != ''">
and jri.EQU_CODE like concat('%',#{dto.equCode},'%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
and other.CODE96333 like concat('%',#{dto.code96333},'%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
and other.supervisory_code like concat('%',#{dto.supervisoryCode},'%')
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND (
use."PROVINCE_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
OR use."CITY_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
OR use."COUNTY_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
OR use."STREET_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
)
</if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
AND ur.receive_company_code = #{dto.receiveCompanyCode}
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
and ur.use_unit_name like concat('%',#{dto.useUnitName},'%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and ur.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and ur.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and ur.use_unit_credit_code = #{dto.useUnitCode}
</if>
GROUP BY re.equip_transfer_id
</where>)
order by
<if test="sort != null">
ur.${sort.field} ${sort.sortType},
</if>
regDate desc, recDate desc
ur.reg_date desc, ur.rec_date desc
</select>
<select id="getDetail" resultType="java.util.Map">
SELECT
......
......@@ -28,6 +28,9 @@
and tjvi.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
</where>
<if test="sort != null">
${sort.field} ${sort.sortType},
</if>
order by apply_no desc
</select>
<sql id="page-list">
......
......@@ -123,6 +123,7 @@ public class JgVehicleInformationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "车用气瓶列表全部数据查询", notes = "车用气瓶列表全部数据查询")
@GetMapping(value = "/getPageList")
public ResponseModel<Page<Map<String, Object>>> getPageList(JgVehicleInformationDto dto,
@RequestParam(value = "sort", required = false) String sort,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<Map<String, Object>> page = new Page<>(current, size);
......@@ -139,7 +140,7 @@ public class JgVehicleInformationController extends BaseController {
} else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
}
Page<Map<String, Object>> list = jgVehicleInformationServiceImpl.getPageList(dto, page, dto.getRoleIds());
Page<Map<String, Object>> list = jgVehicleInformationServiceImpl.getPageList(dto,sort, page, dto.getRoleIds());
list.getRecords().forEach(x -> x.put("companyType", info.getCompany().getCompanyType()));
return ResponseHelper.buildResponse(list);
}
......
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService;
import com.yeejoin.amos.boot.module.jg.api.vo.JgVehicleInformationVo;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
......@@ -839,8 +840,9 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this.update(jgVehicleInformation, lambda);
}
public Page<Map<String, Object>> getPageList(JgVehicleInformationDto dto, Page<Map<String, Object>> page, List<String> roleIds) {
return this.baseMapper.getListPage(page, dto, roleIds);
public Page<Map<String, Object>> getPageList(JgVehicleInformationDto dto, String sort, Page<Map<String, Object>> page, List<String> roleIds) {
SortVo sortMap = commonService.sortFieldConversion(sort);
return this.baseMapper.getListPage(page,sortMap, dto, roleIds);
}
private void updateEquipMessage(JgVehicleInformation jgVehicleInformation, JSONObject map, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment