Commit cbd69c46 authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents 2da5c992 787561b4
......@@ -25,4 +25,7 @@ public interface HygfIcbcRecordMapper extends BaseMapper<HygfIcbcRecord> {
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordDTO> listObject(@Param ("param") HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO);
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordDTO> pageList(@Param ("param") HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO);
}
......@@ -44,18 +44,67 @@
</where>
</select>
<select id="listObject" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO">
SELECT DISTINCT
icbc.sequence_nbr,
ifnull(icbc.cust_name, ph.owners_name) as custName,
ifnull(icbc.phone, ph.telephone) as phone,
ifnull(icbc.id_card, ph.id_card) as idCard,
ph.amos_user_id,
icbc.open_account_status,
icbc.protocol_status,
ph.rec_date
<!-- <select id="listObject" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO">-->
<!-- SELECT DISTINCT-->
<!-- icbc.sequence_nbr,-->
<!-- ifnull(icbc.cust_name, ph.owners_name) as custName,-->
<!-- ifnull(icbc.phone, ph.telephone) as phone,-->
<!-- ifnull(icbc.id_card, ph.id_card) as idCard,-->
<!-- ph.amos_user_id,-->
<!-- icbc.open_account_status,-->
<!-- icbc.protocol_status,-->
<!-- ph.rec_date-->
<!-- FROM-->
<!-- hygf_peasant_household ph LEFT JOIN hygf_icbc_record icbc ON ph.amos_user_id = icbc.amos_user_id-->
<!-- <where>-->
<!-- ph.is_delete = 0-->
<!-- <if test="param != null">-->
<!-- <if test="param.openAccountStatus != null and param.openAccountStatus != ''">-->
<!-- <if test="param.openAccountStatus != '00'">-->
<!-- AND icbc.open_account_status = #{param.openAccountStatus}-->
<!-- </if>-->
<!-- <if test="param.openAccountStatus == '00'">-->
<!-- AND (icbc.open_account_status = #{param.openAccountStatus} OR icbc.open_account_status is null)-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="param.custName != null and param.custName != ''">-->
<!-- AND (ph.owners_name LIKE CONCAT('%', #{param.custName}, '%') OR icbc.cust_name LIKE CONCAT('%', #{param.custName}, '%'))-->
<!-- </if>-->
<!-- <if test="param.idCard != null and param.idCard != ''">-->
<!-- AND (ph.id_card LIKE CONCAT('%', #{param.idCard}, '%') OR icbc.id_card LIKE CONCAT('%', #{param.idCard}, '%'))-->
<!-- </if>-->
<!-- <if test="param.phone != null and param.phone != ''">-->
<!-- AND (ph.telephone LIKE CONCAT('%', #{param.phone}, '%') OR icbc.phone LIKE CONCAT('%', #{param.phone}, '%'))-->
<!-- </if>-->
<!-- <if test="param.regionalCompaniesName != null and param.regionalCompaniesName != ''">-->
<!-- AND ph.regional_companies_name LIKE CONCAT('%', #{param.regionalCompaniesName}, '%')-->
<!-- </if>-->
<!-- <if test="param.addressName != null and param.addressName != ''">-->
<!-- AND ph.project_address LIKE CONCAT('%', #{param.addressName}, '%')-->
<!-- </if>-->
<!-- </if>-->
<!-- </where>-->
<!-- <if test="param.offset != null and param.limit != null">-->
<!-- LIMIT ${param.offset}, ${param.limit}-->
<!-- </if>-->
<!-- ORDER BY-->
<!-- ph.rec_date DESC-->
<!-- </select>-->
<select id="pageList" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO">
SELECT
icbc.sequence_nbr,
ifnull( icbc.cust_name, ph.owners_name ) AS custName,
ifnull( icbc.phone, ph.telephone ) AS phone,
ifnull( icbc.id_card, ph.id_card ) AS idCard,
ph.amos_user_id,
icbc.open_account_status,
icbc.protocol_status,
ph.rec_date,
FROM
hygf_peasant_household ph LEFT JOIN hygf_icbc_record icbc ON ph.amos_user_id = icbc.amos_user_id
(SELECT amos_user_id, is_delete, developer_code,regional_companies_code, developer_user_id, MAX( sequence_nbr ), owners_name, telephone, id_card,regional_companies_name,project_address, rec_date FROM hygf_peasant_household GROUP BY amos_user_id) ph
LEFT JOIN hygf_icbc_record icbc ON ph.amos_user_id = icbc.amos_user_id
<where>
ph.is_delete = 0
<if test="param != null">
......@@ -88,6 +137,6 @@
LIMIT ${param.offset}, ${param.limit}
</if>
ORDER BY
ph.rec_date DESC
ph.rec_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -22,6 +22,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationEngineeringInfoMapper;
......@@ -445,22 +447,33 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
}
public Page<HygfIcbcRecordDTO> queryForPage(int current, int size, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
// PageHelper.startPage(current, size);
Integer total = hygfIcbcRecordMapper.listObjectCount(hygfIcbcRecordQueryDTO);
hygfIcbcRecordQueryDTO.setLimit(size);
if (current == 1) {
hygfIcbcRecordQueryDTO.setOffset(0);
} else {
// int offset = (current - 1) * size > total ? : (current - 1) * size;
hygfIcbcRecordQueryDTO.setOffset((current - 1) * size);
}
List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.listObject(hygfIcbcRecordQueryDTO);
Page<HygfIcbcRecordDTO> page = new Page<>();
page.setSize(size);
page.setCurrent(current);
page.setTotal(total);
page.setRecords(toModels(list));
return page;
PageHelper.startPage(current, size);
List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.pageList(hygfIcbcRecordQueryDTO);
PageInfo<HygfIcbcRecordDTO> page = new PageInfo(list);
Page<HygfIcbcRecordDTO> pagenew = new Page<>();
pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal());
pagenew.setSize(size);
pagenew.setRecords(toModels(page.getList()));
return pagenew;
// ======================================================統計錯誤=================================================================
// // PageHelper.startPage(current, size);
// Integer total = hygfIcbcRecordMapper.listObjectCount(hygfIcbcRecordQueryDTO);
// hygfIcbcRecordQueryDTO.setLimit(size);
// if (current == 1) {
// hygfIcbcRecordQueryDTO.setOffset(0);
// } else {
// // int offset = (current - 1) * size > total ? : (current - 1) * size;
// hygfIcbcRecordQueryDTO.setOffset((current - 1) * size);
// }
// List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.listObject(hygfIcbcRecordQueryDTO);
// Page<HygfIcbcRecordDTO> page = new Page<>();
// page.setSize(size);
// page.setCurrent(current);
// page.setTotal(total);
// page.setRecords(toModels(list));
// return page;
}
private List<HygfIcbcRecordDTO> toModels(List<HygfIcbcRecordDTO> hygfIcbcRecords) {
......
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