12 changed files with 222 additions and 9 deletions
@ -0,0 +1,23 @@ |
|||||||
|
package com.biutag.supervision.controller.baseData; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.model.BusinessPoliceModel; |
||||||
|
import com.biutag.supervision.pojo.param.BusinessQueryParam; |
||||||
|
import com.biutag.supervision.service.BusinessDepartService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("baseData/depart") |
||||||
|
@RestController |
||||||
|
public class BusinessDepartController { |
||||||
|
private final BusinessDepartService businessDepartService; |
||||||
|
|
||||||
|
@GetMapping("page") |
||||||
|
public Result<Page<BusinessPoliceModel>> page(BusinessQueryParam businessQueryParam) { |
||||||
|
return Result.success(businessDepartService.page(businessQueryParam)); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
package com.biutag.supervision.controller.baseData; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.model.BusinessPoliceModel; |
||||||
|
import com.biutag.supervision.pojo.param.BusinessQueryParam; |
||||||
|
import com.biutag.supervision.service.BusinessPoliceService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("baseData/police") |
||||||
|
@RestController |
||||||
|
public class BusinessPoliceController { |
||||||
|
|
||||||
|
private final BusinessPoliceService businessPoliceService; |
||||||
|
|
||||||
|
@GetMapping("page") |
||||||
|
public Result<Page<BusinessPoliceModel>> page(BusinessQueryParam businessQueryParam) { |
||||||
|
return Result.success(businessPoliceService.page(businessQueryParam)); |
||||||
|
} |
||||||
|
} |
||||||
@ -1,8 +1,14 @@ |
|||||||
package com.biutag.supervision.mapper; |
package com.biutag.supervision.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
import com.biutag.supervision.pojo.entity.BusinessDepart; |
import com.biutag.supervision.pojo.entity.BusinessDepart; |
||||||
|
import com.biutag.supervision.pojo.model.BusinessPoliceModel; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
public interface BusinessDepartMapper extends BaseMapper<BusinessDepart> { |
public interface BusinessDepartMapper extends BaseMapper<BusinessDepart> { |
||||||
|
Page<BusinessPoliceModel> queryPage(@Param("page") Page<BusinessPoliceModel> page, @Param(Constants.WRAPPER) QueryWrapper<BusinessPoliceModel> queryWrapper); |
||||||
|
|
||||||
} |
} |
||||||
@ -1,8 +1,13 @@ |
|||||||
package com.biutag.supervision.mapper; |
package com.biutag.supervision.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
import com.biutag.supervision.pojo.entity.BusinessPolice; |
import com.biutag.supervision.pojo.entity.BusinessPolice; |
||||||
|
import com.biutag.supervision.pojo.model.BusinessPoliceModel; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
public interface BusinessPoliceMapper extends BaseMapper<BusinessPolice> { |
public interface BusinessPoliceMapper extends BaseMapper<BusinessPolice> { |
||||||
|
Page<BusinessPoliceModel> queryPage(@Param("page") Page<BusinessPoliceModel> page, @Param(Constants.WRAPPER) QueryWrapper<BusinessPoliceModel> queryWrapper); |
||||||
} |
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
package com.biutag.supervision.pojo.model; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class BusinessPoliceModel { |
||||||
|
// 警员姓名
|
||||||
|
private String policeName; |
||||||
|
|
||||||
|
// 警号
|
||||||
|
private Integer empNo; |
||||||
|
|
||||||
|
// 单位名称
|
||||||
|
private String departName; |
||||||
|
|
||||||
|
// 单位类型
|
||||||
|
private String groupName; |
||||||
|
|
||||||
|
// 110接处警
|
||||||
|
private Integer jiechujing110; |
||||||
|
|
||||||
|
// 122接处警
|
||||||
|
private Integer jiechujing122; |
||||||
|
|
||||||
|
// 身份证业务
|
||||||
|
private Integer shenfenzhengyewu; |
||||||
|
|
||||||
|
// 执法办案
|
||||||
|
private Integer zhifabanan; |
||||||
|
|
||||||
|
// 户口业务
|
||||||
|
private Integer hukouyewu; |
||||||
|
|
||||||
|
// 出入境业务
|
||||||
|
private Integer churujingyewu; |
||||||
|
|
||||||
|
// 车辆上牌
|
||||||
|
private Integer cheliangshangpai; |
||||||
|
|
||||||
|
// 驾驶人考试
|
||||||
|
private Integer jiashirenkaoshi; |
||||||
|
} |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
package com.biutag.supervision.pojo.param; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class BusinessQueryParam { |
||||||
|
private long current = 1; |
||||||
|
private long size = 10; |
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||||
|
private List<Date> happenTime = new ArrayList<>(); |
||||||
|
// 姓名
|
||||||
|
private String policeName; |
||||||
|
// 警号
|
||||||
|
private String empNo; |
||||||
|
// 单位名称
|
||||||
|
private String departName; |
||||||
|
// 单位类型
|
||||||
|
private String groupName; |
||||||
|
// 排序字段
|
||||||
|
private String sortField; |
||||||
|
// 排序顺序(ASC 或 DESC)
|
||||||
|
private String sortOrder; |
||||||
|
} |
||||||
@ -1,11 +1,27 @@ |
|||||||
package com.biutag.supervision.service; |
package com.biutag.supervision.service; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
import com.biutag.supervision.pojo.entity.BusinessDepart; |
import com.biutag.supervision.pojo.entity.BusinessDepart; |
||||||
import com.biutag.supervision.mapper.BusinessDepartMapper; |
import com.biutag.supervision.mapper.BusinessDepartMapper; |
||||||
|
import com.biutag.supervision.pojo.model.BusinessPoliceModel; |
||||||
|
import com.biutag.supervision.pojo.param.BusinessQueryParam; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
@Service |
@Service |
||||||
public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, BusinessDepart> { |
public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, BusinessDepart> { |
||||||
|
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) { |
||||||
|
QueryWrapper<BusinessPoliceModel> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper |
||||||
|
.like(StrUtil.isNotBlank(businessQueryParam.getDepartName()), "depart_name", businessQueryParam.getDepartName()) |
||||||
|
.eq(StrUtil.isNotBlank(businessQueryParam.getGroupName()), "group_name", businessQueryParam.getGroupName()) |
||||||
|
.groupBy("depart_name") |
||||||
|
.orderBy(StrUtil.isNotBlank(businessQueryParam.getSortField()), businessQueryParam.getSortOrder().equals("ASC"), businessQueryParam.getSortField()); |
||||||
|
if (businessQueryParam.getHappenTime().size() == 2) { |
||||||
|
queryWrapper.between("date", businessQueryParam.getHappenTime().get(0), businessQueryParam.getHappenTime().get(1)); |
||||||
|
} |
||||||
|
return baseMapper.queryPage(Page.of(businessQueryParam.getCurrent(), businessQueryParam.getSize()), queryWrapper); |
||||||
|
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,11 +1,32 @@ |
|||||||
package com.biutag.supervision.service; |
package com.biutag.supervision.service; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
import com.biutag.supervision.pojo.entity.BusinessPolice; |
|
||||||
import com.biutag.supervision.mapper.BusinessPoliceMapper; |
import com.biutag.supervision.mapper.BusinessPoliceMapper; |
||||||
|
import com.biutag.supervision.pojo.entity.BusinessPolice; |
||||||
|
import com.biutag.supervision.pojo.model.BusinessPoliceModel; |
||||||
|
import com.biutag.supervision.pojo.param.BusinessQueryParam; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
@Service |
@Service |
||||||
public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, BusinessPolice> { |
public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, BusinessPolice> { |
||||||
|
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) { |
||||||
|
String empNo = ""; |
||||||
|
if (businessQueryParam.getEmpNo() != null && !businessQueryParam.getEmpNo().isEmpty()) { |
||||||
|
empNo = String.valueOf(Integer.parseInt(businessQueryParam.getEmpNo())); |
||||||
|
} |
||||||
|
QueryWrapper<BusinessPoliceModel> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.like(StrUtil.isNotBlank(businessQueryParam.getPoliceName()), "police_name", businessQueryParam.getPoliceName()) |
||||||
|
.like(StrUtil.isNotBlank(empNo), "emp_no", empNo) |
||||||
|
.like(StrUtil.isNotBlank(businessQueryParam.getDepartName()), "depart_name", businessQueryParam.getDepartName()) |
||||||
|
.eq(StrUtil.isNotBlank(businessQueryParam.getGroupName()), "group_name", businessQueryParam.getGroupName()) |
||||||
|
.groupBy("police_name") |
||||||
|
.orderBy(StrUtil.isNotBlank(businessQueryParam.getSortField()), businessQueryParam.getSortOrder().equals("ASC"), businessQueryParam.getSortField()); |
||||||
|
if (businessQueryParam.getHappenTime().size() == 2) { |
||||||
|
queryWrapper.between("date", businessQueryParam.getHappenTime().get(0), businessQueryParam.getHappenTime().get(1)); |
||||||
|
} |
||||||
|
return baseMapper.queryPage(Page.of(businessQueryParam.getCurrent(), businessQueryParam.getSize()), queryWrapper); |
||||||
|
} |
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,22 @@ |
|||||||
|
<?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.biutag.supervision.mapper.BusinessDepartMapper"> |
||||||
|
|
||||||
|
<select id="queryPage" resultType="com.biutag.supervision.pojo.model.BusinessPoliceModel"> |
||||||
|
select depart_name, group_name, |
||||||
|
SUM(CASE WHEN business_type = 1 THEN number ELSE 0 END) AS jiechujing110, |
||||||
|
SUM(CASE WHEN business_type = 2 THEN number ELSE 0 END) AS jiechujing122, |
||||||
|
SUM(CASE WHEN business_type = 3 THEN number ELSE 0 END) AS shenfenzhengyewu, |
||||||
|
SUM(CASE WHEN business_type = 4 THEN number ELSE 0 END) AS zhifabanan, |
||||||
|
SUM(CASE WHEN business_type = 5 THEN number ELSE 0 END) AS hukouyewu, |
||||||
|
SUM(CASE WHEN business_type = 6 THEN number ELSE 0 END) AS churujingyewu, |
||||||
|
SUM(CASE WHEN business_type = 7 THEN number ELSE 0 END) AS cheliangshangpai, |
||||||
|
SUM(CASE WHEN business_type = 8 THEN number ELSE 0 END) AS jiashirenkaoshi |
||||||
|
from business_depart |
||||||
|
${ew.getCustomSqlSegment} |
||||||
|
</select> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
<?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.biutag.supervision.mapper.BusinessPoliceMapper"> |
||||||
|
|
||||||
|
<select id="queryPage" resultType="com.biutag.supervision.pojo.model.BusinessPoliceModel"> |
||||||
|
select police_name, emp_no, depart_name, group_name, |
||||||
|
SUM(CASE WHEN business_type = 1 THEN number ELSE 0 END) AS jiechujing110, |
||||||
|
SUM(CASE WHEN business_type = 2 THEN number ELSE 0 END) AS jiechujing122, |
||||||
|
SUM(CASE WHEN business_type = 3 THEN number ELSE 0 END) AS shenfenzhengyewu, |
||||||
|
SUM(CASE WHEN business_type = 4 THEN number ELSE 0 END) AS zhifabanan, |
||||||
|
SUM(CASE WHEN business_type = 5 THEN number ELSE 0 END) AS hukouyewu, |
||||||
|
SUM(CASE WHEN business_type = 6 THEN number ELSE 0 END) AS churujingyewu, |
||||||
|
SUM(CASE WHEN business_type = 7 THEN number ELSE 0 END) AS cheliangshangpai, |
||||||
|
SUM(CASE WHEN business_type = 8 THEN number ELSE 0 END) AS jiashirenkaoshi |
||||||
|
from business_police |
||||||
|
${ew.getCustomSqlSegment} |
||||||
|
</select> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
||||||
Loading…
Reference in new issue