智慧保安后台管理-验收版本
分局预警统计接口新增(统计各个辖区对应(表现差+审查异常+持证率低于50%公司个数+派遣率低于50%公司个数+社保缴纳率低于50%公司个数+考试通过率低于50%公司个数)预警总数)
6 files modified
8 files added
842 ■■■■■ changed files
src/main/java/org/springblade/modules/information/controller/InformationsController.java 94 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml 203 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/IInformationService.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java 38 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/vo/InformationVO.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/vo/ResponseVo.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/controller/InsuranceController.java 119 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/entity/Insurance.java 112 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/mapper/InsuranceMapper.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/mapper/InsuranceMapper.xml 37 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/service/InsuranceService.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/service/impl/InsuranceServiceImpl.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/insurance/vo/InsuranceVO.java 36 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/controller/InformationsController.java
@@ -7,9 +7,17 @@
import org.springblade.core.tool.api.R;
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.information.vo.ResponseVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
/**
 * 组织机构详情控制层 2
@@ -133,4 +141,90 @@
    public R<IPage<InformationVO>> getSecurityUnitServerLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitServerLess2Page(Condition.getPage(query), information));
    }
    /**
     * 首页分局预警统计(保安员预警(表现差,审查异常),保安公司预警(考试通过率低于50%,持证率低于50%,社保缴纳率低于50%,派遣率低于50%))
     * @return
     */
    @PostMapping("/selectSubstationWarnInfo")
    public R selectSubstationWarnInfo() {
        //辖区信息
        List<Map<Object, Object>> list = informationService.selectJur();
        List<Map<String, Object>> lists = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            int count = 0;
            Map<String, Object> map = new HashMap<String, Object>();
            //辖区id
            String id = list.get(i).get("id").toString();
            //辖区名称
            String jurname = list.get(i).get("dept_name").toString();
            //1.保安员表现差预警数量
            List<ResponseVo> performanceGroupCountList = informationService.getSecurityPerformanceGroupCountList();
            //遍历计算总数
            for (ResponseVo responseVo : performanceGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += performanceGroupCountList.get(i).getNum();
                }
            }
            //2.保安员资格异常的数量
            List<ResponseVo> examinationGroupCountList = informationService.getSecurityExaminationGroupCountList();
            //遍历计算总数
            for (ResponseVo responseVo : examinationGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += examinationGroupCountList.get(i).getNum();
                }
            }
            //3.考试通过率低于50%
            List<ResponseVo> examPassingGroupCountList = informationService.getSecurityExamPassingGroupCountList();
            //遍历计算总数
            for (ResponseVo responseVo : examPassingGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += examPassingGroupCountList.get(i).getNum();
                }
            }
            //4.持证率低于50%
            List<ResponseVo> holdGroupCountList = informationService.getSecurityHoldAndSoidAndDispatchGroupCountList(1);
            //遍历计算总数
            for (ResponseVo responseVo : holdGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += holdGroupCountList.get(i).getNum();
                }
            }
            //5.社保缴纳率低于50%
            List<ResponseVo> soidGroupCountList = informationService.getSecurityHoldAndSoidAndDispatchGroupCountList(2);
            //遍历计算总数
            for (ResponseVo responseVo : soidGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += soidGroupCountList.get(i).getNum();
                }
            }
            //6.派遣率低于50%
            List<ResponseVo> dispatchGroupCountList = informationService.getSecurityHoldAndSoidAndDispatchGroupCountList(3);
            //遍历计算总数
            for (ResponseVo responseVo : dispatchGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += dispatchGroupCountList.get(i).getNum();
                }
            }
            //封装数据
            map.put("Count", count);
            map.put("jurname", jurname);
            map.put("id", id);
            lists.add(map);
        }
        return R.data(lists);
    }
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.java
@@ -24,6 +24,7 @@
import org.springblade.modules.information.vo.InformationVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.information.vo.ResponseVo;
import org.springframework.boot.autoconfigure.quartz.QuartzDataSource;
import java.util.List;
@@ -153,4 +154,29 @@
     * @return
     */
    List<InformationVO> getSecurityUnitServerLess2Page(IPage<InformationVO> page,@Param("information") InformationVO information);
    /**
     * 统计表现差的信息
     * @return
     */
    List<ResponseVo> getSecurityPerformanceGroupCountList();
    /**
     * 统计资格审查异常信息
     * @return
     */
    List<ResponseVo> getSecurityExaminationGroupCountList();
    /**
     * 考试通过率低于50%
     * @return
     */
    List<ResponseVo> getSecurityExamPassingGroupCountList();
    /**
     *  查询 1 持证率低于50%, 2 社保缴纳率低于50%, 3 派遣率低于50%
     * @param type 1 持证率低于50%, 2 社保缴纳率低于50%, 3 派遣率低于50%
     * @return
     */
    List<ResponseVo> getSecurityHoldAndSoidAndDispatchGroupCountList(Integer type);
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -2050,6 +2050,7 @@
        ifnull(a.count,0) znum,
        ifnull(b.count,0) cnum,
        ifnull(FORMAT((b.count/c.count)*100,2),0) pnum
        ifnull(c.count,0) knum,
        from sys_information si
        left join
        (
@@ -2127,6 +2128,7 @@
        d.jurisdiction = sj.id
        where 1=1
        and (d.stats = 2 or d.stats = 4)
        and knum != 0
        and pnum &lt; #{information.proportion}
        <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
            and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
@@ -2272,4 +2274,205 @@
            and b.departmentid = #{information.departmentid}
        </if>
    </select>
    <!--统计表现差的信息-->
    <select id="getSecurityPerformanceGroupCountList" resultType="org.springblade.modules.information.vo.ResponseVo">
        select
            a.id,a.dept_name name,ifnull(b.count,0) num
        from
            (select id,dept_name from sys_jurisdiction where parent_id = 1372091709474910209) a
        left join
        (
            select
                sj.id,sj.parent_id,count(*) count
                from sys_performance sp
                left join
                blade_user bu
                on
                bu.id = sp.securityId
                left join
                sys_information si
                on
                bu.dept_id = si.departmentid
                left join
                sys_jurisdiction sj
                on
                sj.id = si.jurisdiction
                where
                1=1
                and (si.stats = 2 or si.stats =4)
                and bu.is_deleted = 0
                and bu.`status` = 1
                and sp.score = 3
                group by si.jurisdiction
         ) b
              on
        a.id = b.parent_id
    </select>
    <!--统计资格审查异常信息-->
    <select id="getSecurityExaminationGroupCountList" resultType="org.springblade.modules.information.vo.ResponseVo">
        select a.id,a.dept_name name,ifnull(b.count,0) num
            from
        (select id,dept_name from sys_jurisdiction where parent_id = 1372091709474910209) a
            left join
        (
        select
                sj.id,sj.parent_id,count(*) count
                from
                blade_user bu
                left join
                sys_information si
                on
                bu.dept_id = si.departmentid
                left join
                sys_jurisdiction sj
                on
                sj.id = si.jurisdiction
                where
                1=1
                and (si.stats = 2 or si.stats =4)
                and bu.is_deleted = 0
                and bu.`status` = 1
                and bu.examination_type = 1
                group by si.jurisdiction
         ) b
            on
        a.id = b.parent_id
    </select>
    <!--考试通过率低于50%-->
    <select id="getSecurityExamPassingGroupCountList" resultType="org.springblade.modules.information.vo.ResponseVo">
        select g.id,g.dept_name name,ifnull(f.count,0) num
        from
        (select id,dept_name from sys_jurisdiction where parent_id = 1372091709474910209) g
        left join
        (
            select e.id,e.parent_id,count(*) count from (
                select d.*,ifnull(FORMAT((num2/num1)*100,2),0) num3,sj.* from (
                select a.dept_id,ifnull(b.count,0) num1,ifnull(c.count,0) num2 from
                (
                    select
                    bu.dept_id,ifnull(count(*),0) count
                    from blade_user bu
                    left join blade_role br
                    on bu.role_id = br.id
                    where
                    role_alias = "安保人员"
                    and bu.is_deleted = 0
                    and bu.`status` = 1
                    group by dept_id
                    ) a
                    left join
                    (
                    select count(*) count,bu.dept_id from
                    exam_score es
                    left join
                    blade_user bu
                    on
                    bu.id = es.user_id
                    where 1=1 group by bu.dept_id
                    ) b
                    on
                    a.dept_id = b.dept_id
                    left join
                    (
                    select count(*) count,bu.dept_id from
                    exam_score es
                    left join
                    blade_user bu
                    on
                    bu.id = es.user_id
                    where qualified = 0 group by bu.dept_id
                    ) c
                    on a.dept_id = c.dept_id
                )d
                left join
                sys_information si
                on
                si.departmentid = d.dept_id
                left join
                sys_jurisdiction sj
                on
                sj.id = si.jurisdiction
                where d.num1!=0
                and (stats = 2 or stats=4)
            )e
            where e.num3 &lt; 50
            group by e.id
        ) f
        on
        g.id = f.parent_id
    </select>
    <!--持证率低于50%,社保缴纳率低于50%,派遣率低于50%-->
    <select id="getSecurityHoldAndSoidAndDispatchGroupCountList" resultType="org.springblade.modules.information.vo.ResponseVo">
        select g.id,g.dept_name name,ifnull(f.count,0) num
            from
        (select id,dept_name from sys_jurisdiction where parent_id = 1372091709474910209) g
            left join
        (
            select e.id,e.parent_id,count(*) count from (
                select d.*,ifnull(FORMAT((num2/num1)*100,2),0) num3,sj.* from (
                    select a.dept_id,ifnull(a.count,0) num1,ifnull(b.count,0) num2 from
                    (
                    select
                    bu.dept_id,ifnull(count(*),0) count
                    from blade_user bu
                    left join blade_role br
                    on bu.role_id = br.id
                    where
                    role_alias = "安保人员"
                    and bu.is_deleted = 0
                    and bu.`status` = 1
                    group by dept_id
                    ) a
                    left join
                    (
                    select
                    bu.dept_id,ifnull(count(*),0) count
                    from blade_user bu
                    left join blade_role br
                    on bu.role_id = br.id
                    where
                    role_alias = "安保人员"
                    and bu.is_deleted = 0
                    and bu.`status` = 1
                    <if test="type==1">
                        and bu.hold = 1
                    </if>
                    <if test="type==2">
                        and bu.dispatch = 0
                    </if>
                    <if test="type==3">
                        and bu.soil = 0
                    </if>
                    group by dept_id
                    ) b
                    on
                    a.dept_id = b.dept_id
                )d
                left join
                sys_information si
                on
                si.departmentid = d.dept_id
                left join
                sys_jurisdiction sj
                on
                sj.id = si.jurisdiction
                and (stats = 2 or stats=4)
            )e
            where e.num3 &lt; 50
            group by e.id
        ) f
            on
        g.id = f.parent_id
    </select>
</mapper>
src/main/java/org/springblade/modules/information/service/IInformationService.java
@@ -23,6 +23,7 @@
import org.springblade.modules.information.vo.InformationVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.information.vo.ResponseVo;
import java.util.List;
import java.util.Map;
@@ -171,4 +172,29 @@
     * @return
     */
    IPage<InformationVO> getSecurityUnitInsuranceLessPage(IPage<InformationVO> page, InformationVO information);
    /**
     * 统计表现差的信息
     * @return
     */
    List<ResponseVo> getSecurityPerformanceGroupCountList();
    /**
     * 统计资格审查异常信息
     * @return
     */
    List<ResponseVo> getSecurityExaminationGroupCountList();
    /**
     * 考试通过率低于50%
     * @return
     */
    List<ResponseVo> getSecurityExamPassingGroupCountList();
    /**
     *  查询 1 持证率低于50%, 2 社保缴纳率低于50%, 3 派遣率低于50%
     * @param type 1 持证率低于50%, 2 社保缴纳率低于50%, 3 派遣率低于50%
     * @return
     */
    List<ResponseVo> getSecurityHoldAndSoidAndDispatchGroupCountList(Integer type);
}
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java
@@ -22,6 +22,7 @@
import org.springblade.modules.information.mapper.InformationMapper;
import org.springblade.modules.information.service.IInformationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.information.vo.ResponseVo;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -398,4 +399,41 @@
    public IPage<InformationVO> getSecurityUnitInsuranceLessPage(IPage<InformationVO> page, InformationVO information) {
        return page.setRecords(baseMapper.getSecurityUnitLess50Page(page,4, information));
    }
    /**
     * 统计表现差的信息
     * @return
     */
    @Override
    public List<ResponseVo> getSecurityPerformanceGroupCountList() {
        return baseMapper.getSecurityPerformanceGroupCountList();
    }
    /**
     * 统计资格审查异常信息
     * @return
     */
    @Override
    public List<ResponseVo> getSecurityExaminationGroupCountList() {
        return baseMapper.getSecurityExaminationGroupCountList();
    }
    /**
     * 考试通过率低于50%
     * @return
     */
    @Override
    public List<ResponseVo> getSecurityExamPassingGroupCountList() {
        return baseMapper.getSecurityExamPassingGroupCountList();
    }
    /**
     *  查询 1 持证率低于50%, 2 社保缴纳率低于50%, 3 派遣率低于50%
     * @param type 1 持证率低于50%, 2 社保缴纳率低于50%, 3 派遣率低于50%
     * @return
     */
    @Override
    public List<ResponseVo> getSecurityHoldAndSoidAndDispatchGroupCountList(Integer type) {
        return baseMapper.getSecurityHoldAndSoidAndDispatchGroupCountList(type);
    }
}
src/main/java/org/springblade/modules/information/vo/InformationVO.java
@@ -57,4 +57,7 @@
     * 占比
     */
    private Integer proportion;
    private Integer knum;
}
src/main/java/org/springblade/modules/information/vo/ResponseVo.java
New file
@@ -0,0 +1,21 @@
package org.springblade.modules.information.vo;
import lombok.Data;
import java.io.Serializable;
/**
 * 统计返回结果
 * @author zhongrj
 * @since 2021-9-17
 */
@Data
public class ResponseVo implements Serializable {
    private String id;
    private String name;
    private Integer num;
}
src/main/java/org/springblade/modules/insurance/controller/InsuranceController.java
New file
@@ -0,0 +1,119 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.insurance.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.insurance.entity.Insurance;
import org.springblade.modules.insurance.service.InsuranceService;
import org.springblade.modules.insurance.vo.InsuranceVO;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
 *  保险缴纳控制器
 *
 * @author zhongrj
 * @since 2021-9-16
 */
@RestController
@AllArgsConstructor
@RequestMapping("/insurance")
@Api(value = "", tags = "接口")
public class InsuranceController extends BladeController {
    private final InsuranceService insuranceService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    public R<Insurance> detail(Insurance insurance) {
        Insurance detail = insuranceService.getOne(Condition.getQueryWrapper(insurance));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    public R<IPage<Insurance>> list(Insurance insurance, Query query) {
        IPage<Insurance> pages = insuranceService.page(Condition.getPage(query), Condition.getQueryWrapper(insurance));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    public R<IPage<InsuranceVO>> page(InsuranceVO insuranceVO, Query query) {
        IPage<InsuranceVO> pages = insuranceService.selectInsurancePage(Condition.getPage(query), insuranceVO);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    public R save(@Valid @RequestBody Insurance insurance) {
        return R.status(insuranceService.save(insurance));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入insurance")
    public R update(@Valid @RequestBody Insurance insurance) {
        return R.status(insuranceService.updateById(insurance));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入insurance")
    public R submit(@Valid @RequestBody Insurance insurance) {
        return R.status(insuranceService.saveOrUpdate(insurance));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(insuranceService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/insurance/entity/Insurance.java
New file
@@ -0,0 +1,112 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.insurance.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 实体类
 *
 * @author zhongrj
 * @since 2021-9-16
 */
@Data
@TableName("sys_insurance")
public class Insurance implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
    * 姓名
    */
        @ApiModelProperty(value = "姓名")
        private String name;
    /**
    * 性别
    */
        @ApiModelProperty(value = "性别")
        private String sex;
    /**
    * 民族
    */
        @ApiModelProperty(value = "民族")
        private String nation;
    /**
    * 出生日期
    */
        @ApiModelProperty(value = "出生日期")
        @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
        @DateTimeFormat(pattern = "yyyy-MM-dd")
        private Date birthday;
    /**
    * 联系电话
    */
        @ApiModelProperty(value = "联系电话")
        private String telephone;
    /**
    * 身份证号
    */
        @ApiModelProperty(value = "身份证号")
        private String cardid;
    /**
    * 户籍所在地址
    */
        @ApiModelProperty(value = "户籍所在地址")
        private String residence;
    /**
    * 居住地址
    */
        @ApiModelProperty(value = "居住地址  ")
        private String address;
    /**
    * 户籍性质
    */
        @ApiModelProperty(value = "户籍性质")
        private String nature;
    /**
    * 个人缴费额
    */
        @ApiModelProperty(value = "个人缴费额")
        private float amount ;
    /**
    * 参保时间
    */
        @ApiModelProperty(value = "参保时间")
        @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
        @DateTimeFormat(pattern = "yyyy-MM-dd")
        private Date insuredtime;
    /**
    * 单位id
    */
        @ApiModelProperty(value = "单位id")
        private String deptid;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
}
src/main/java/org/springblade/modules/insurance/mapper/InsuranceMapper.java
New file
@@ -0,0 +1,44 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.insurance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.insurance.entity.Insurance;
import org.springblade.modules.insurance.vo.InsuranceVO;
import java.util.List;
/**
 *  保险缴纳Mapper 接口
 *
 * @author zhongrj
 * @since 2021-9-16
 */
public interface InsuranceMapper extends BaseMapper<Insurance> {
    /**
     * 自定义分页
     *
     * @param page
     * @param insurance
     * @return
     */
    List<InsuranceVO> selectInsurancePage(IPage page, @Param("insurance") InsuranceVO insurance);
}
src/main/java/org/springblade/modules/insurance/mapper/InsuranceMapper.xml
New file
@@ -0,0 +1,37 @@
<?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="org.springblade.modules.insurance.mapper.InsuranceMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="socialResultMap" type="org.springblade.modules.insurance.vo.InsuranceVO">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="sex" property="sex"/>
        <result column="nation" property="nation"/>
        <result column="birthday" property="birthday"/>
        <result column="telephone" property="telephone"/>
        <result column="cardid" property="cardid"/>
        <result column="residence" property="residence"/>
        <result column="address" property="address"/>
        <result column="nature" property="nature"/>
        <result column="amount" property="amount"/>
        <result column="insuredtime" property="insuredtime"/>
        <result column="deptid" property="deptid"/>
    </resultMap>
    <select id="selectInsurancePage" resultMap="socialResultMap">
        select * from sys_insurance
        where 1=1
        <if test="insurance.name!=null and insurance.name!=''">
            and insurance.name like concat('%',#{insurance.name},'%')
        </if>
        <if test="insurance.cardid!=null and insurance.cardid!=''">
            and insurance.cardid like concat('%',#{insurance.cardid},'%')
        </if>
        <if test="insurance.deptid!=null and insurance.deptid!=''">
            and insurance.deptid like concat('%',#{insurance.deptid},'%')
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/insurance/service/InsuranceService.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.insurance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.insurance.entity.Insurance;
import org.springblade.modules.insurance.vo.InsuranceVO;
import java.util.List;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2021-07-16
 */
public interface InsuranceService extends IService<Insurance> {
    /**
     * 自定义分页
     *
     * @param page
     * @param insurance
     * @return
     */
    IPage<InsuranceVO> selectInsurancePage(IPage<InsuranceVO> page, InsuranceVO insurance);
}
src/main/java/org/springblade/modules/insurance/service/impl/InsuranceServiceImpl.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.insurance.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.insurance.service.InsuranceService;
import org.springblade.modules.insurance.entity.Insurance;
import org.springblade.modules.insurance.mapper.InsuranceMapper;
import org.springblade.modules.insurance.vo.InsuranceVO;
import org.springframework.stereotype.Service;
/**
 *  保险缴纳服务实现类
 *
 * @author zhongrj
 * @since 2021-09-16
 */
@Service
public class InsuranceServiceImpl extends ServiceImpl<InsuranceMapper, Insurance> implements InsuranceService {
    @Override
    public IPage<InsuranceVO> selectInsurancePage(IPage<InsuranceVO> page, InsuranceVO insuranceVO) {
        return page.setRecords(baseMapper.selectInsurancePage(page, insuranceVO));
    }
}
src/main/java/org/springblade/modules/insurance/vo/InsuranceVO.java
New file
@@ -0,0 +1,36 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.insurance.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.insurance.entity.Insurance;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2021-07-16
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SocialVO对象", description = "SocialVO对象")
public class InsuranceVO extends Insurance {
    private static final long serialVersionUID = 1L;
}