统一-下拉选
This commit is contained in:
parent
fc0d7cac8a
commit
7e5b48872f
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.sgzb.system.controller;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.system.domain.SelectDto;
|
||||
import com.bonus.sgzb.system.service.SelectService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
* 统一下拉选
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/select/")
|
||||
public class SelectController {
|
||||
|
||||
@Resource(name = "SelectService")
|
||||
private SelectService service;
|
||||
|
||||
@ApiOperation(value = "往来单位下拉选")
|
||||
@PostMapping("getUnitData")
|
||||
public AjaxResult getUnitData(SelectDto dto) {
|
||||
return service.getUnitData(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工程下拉选")
|
||||
@PostMapping("getProData")
|
||||
public AjaxResult getProData(SelectDto dto) {
|
||||
return service.getProData(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.sgzb.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
*/
|
||||
@Data
|
||||
public class SelectDto {
|
||||
|
||||
/** 参数id*/
|
||||
private String id;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.sgzb.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
*/
|
||||
@Data
|
||||
public class SelectVo {
|
||||
|
||||
/** id*/
|
||||
private long id;
|
||||
|
||||
/** 名称*/
|
||||
private String titleName;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bonus.sgzb.system.mapper;
|
||||
|
||||
import com.bonus.sgzb.system.domain.SelectDto;
|
||||
import com.bonus.sgzb.system.domain.SelectVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
* 统一下拉选
|
||||
*/
|
||||
@Repository("SelectMapper")
|
||||
public interface SelectMapper {
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<SelectVo>
|
||||
* @description 往来单位
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 14:23
|
||||
*/
|
||||
List<SelectVo> getUnitData(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<SelectVo>
|
||||
* @description 工程
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 15:05
|
||||
*/
|
||||
List<SelectVo> getProData(SelectDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.sgzb.system.service;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.system.domain.SelectDto;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
* 统一下拉选
|
||||
*/
|
||||
public interface SelectService {
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 往来单位
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 14:20
|
||||
*/
|
||||
AjaxResult getUnitData(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 工程
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 15:04
|
||||
*/
|
||||
AjaxResult getProData(SelectDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.sgzb.system.service.impl;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.system.domain.SelectDto;
|
||||
import com.bonus.sgzb.system.domain.SelectVo;
|
||||
import com.bonus.sgzb.system.mapper.SelectMapper;
|
||||
import com.bonus.sgzb.system.service.SelectService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
* 统一下拉选
|
||||
*/
|
||||
@Service("SelectService")
|
||||
@Slf4j
|
||||
public class SelectServiceImpl implements SelectService {
|
||||
|
||||
@Resource(name = "SelectMapper")
|
||||
private SelectMapper mapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult getUnitData(SelectDto dto) {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getUnitData(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("往来单位-查询失败",e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProData(SelectDto dto) {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getProData(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("工程-查询失败",e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.sgzb.system.mapper.SelectMapper">
|
||||
|
||||
<!--往来单位-->
|
||||
<select id="getUnitData" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
/*根据标段工程id关联协议查询往来单位*/
|
||||
<if test="id != null and id != ''">
|
||||
SELECT DISTINCT bui.unit_id AS id,
|
||||
bui.unit_name AS titleName
|
||||
FROM bm_project_lot bpl
|
||||
LEFT JOIN bm_agreement_info bai ON bpl.lot_id = bai.project_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id AND bui.del_flag = '0'
|
||||
WHERE bpl.lot_id = #{id} AND bpl.del_flag = '0'
|
||||
</if>
|
||||
<if test="id == null or id == ''">
|
||||
SELECT unit_id AS id,
|
||||
unit_name AS titleName
|
||||
FROM bm_unit_info
|
||||
WHERE del_flag = '0'
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--工程-->
|
||||
<select id="getProData" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
/*根据往来单位id关联协议查询工程*/
|
||||
<if test="id != null and id != ''">
|
||||
SELECT DISTINCT bpl.lot_id AS id,
|
||||
bpl.lot_name AS titleName
|
||||
FROM bm_unit_info bui
|
||||
LEFT JOIN bm_agreement_info bai ON bui.unit_id = bai.unit_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id AND bpl.del_flag = '0'
|
||||
WHERE bui.unit_id = #{id} AND bui.del_flag = '0'
|
||||
</if>
|
||||
<if test="id == null or id == ''">
|
||||
SELECT lot_id AS id,
|
||||
lot_name AS titleName
|
||||
FROM bm_project_lot
|
||||
WHERE del_flag = '0'
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue