Commit 6bf07815 by 翁国栋 Committed by 284718418@qq.com

运营后台--

用户保单列表条件查询
parent bc5043cc
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
......@@ -12,6 +13,7 @@ import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.beust.jcommander.internal.Lists;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Maps;
......@@ -41,9 +43,9 @@ public class InsureUserController{
@ApiOperation(value = "3.保单列表--运营后台", httpMethod = "Post", notes = "保单列表")
public Result<Object> policyList(@RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap();
List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto.getPage(), String.valueOf(policyDto.getId()));
List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto);
map.put("list", Optional.ofNullable(list).orElse(Lists.newArrayList()));
map.put("total", insureUserMapper.totalUser(String.valueOf(policyDto.getId())));
map.put("total", insureUserMapper.totalUser(policyDto));
return ResultUtil.data(map);
}
@GetMapping(value = "/userDetial")
......@@ -55,11 +57,16 @@ public class InsureUserController{
@PostMapping(value = "/userPolicyList")
@ApiOperation(value = "3.保单列表--8小时端", httpMethod = "Post", notes = "保单列表")
public Result<Object> userPolicyList(@CurrentUser UserBean userBean, @RequestBody Page page) {
public Result<Object> userPolicyList(@CurrentUser UserBean userBean, PolicyDto policyDto) {
Map map = Maps.newHashMap();
List<PolicyDto> list = insureUserMapper.selectPolicyList(page, String.valueOf(userBean.getOrgCode()));
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getOrgCode,userBean.getOrgCode()).eq(InsurePolicy::getStatus,1));
if(insurePolicy==null){
return ResultUtil.error("保单号不存在");
}
policyDto.setId(insurePolicy.getId());
List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto);
map.put("list", Optional.ofNullable(list).orElse(Lists.newArrayList()));
map.put("total", insureUserMapper.totalUser(String.valueOf(userBean.getOrgCode())));
map.put("total", insureUserMapper.totalUser(policyDto));
return ResultUtil.data(map);
}
......
......@@ -19,8 +19,8 @@ import java.util.List;
*/
@Repository
public interface InsureUserMapper extends BaseMapper<InsureUser> {
List<PolicyDto> selectPolicyList(@Param("page") Page page,@Param("id") String id);
Integer totalUser(@Param("id")String id);
List<PolicyDto> selectPolicyList(@Param("policyDto") PolicyDto policyDto );
Integer totalUser(@Param("policyDto") PolicyDto policyDto);
List<InsureUser> selectListByIds(@Param("array")String[] ids);
}
......@@ -283,12 +283,20 @@
from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id
where yme.org_code = 3
<if test="id !=null and id !=''">
and ip.id=#{id}
<where>
ip.id=#{policyDto.id}
<if test="policyDto.name !=null and policyDto.name !=''">
and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%')
</if>
<if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !=''">
and iu.policy_date_start <![CDATA[>=]]> #{policyDto.policyDateStart}
</if>
<if test="page.offset != null and page.totalPage !=null">
limit #{page.offset},#{page.totalPage}
<if test="policyDto.status !=null and policyDto.status !=''">
and iu.insure_status = #{policyDto.status}
</if>
</where>
<if test="policyDto.page.offset != null and policyDto.page.totalPage !=null">
LIMIT #{policyDto.page.offset},#{policyDto.page.totalPage}
</if>
</select>
......@@ -296,10 +304,17 @@
select count(iu.id) from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id
where yme.org_code = 3
<if test="id !=null and id !=''">
and ip.id=#{id}
<where>
<if test="policyDto.id !=null and policyDto.id !=''">
and ip.id=#{policyDto.id}
</if>
<if test="policyDto.name !=null and policyDto.name !=''">
and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%')
</if>
<if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !=''">
and iu.policy_date_start <![CDATA[>=]]> #{policyDto.policyDateStart}
</if>
</where>
</select>
<!--根据id数组查询员工-->
......
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