部分接口改造

localizer
lzq 2025-09-10 12:07:48 +08:00
parent e1fda4ad1b
commit e9d6c3b1e3
20 changed files with 2675 additions and 63 deletions

View File

@ -70,6 +70,8 @@ public class UserDetail implements CredentialsContainer, Principal {
*/
private Boolean disabled;
private String bizObj;
/**
*
*/

View File

@ -3,7 +3,6 @@ package com.njzscloud.supervisory.biz.controller;
import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.biz.contant.BizObj;
import com.njzscloud.supervisory.biz.pojo.*;
import com.njzscloud.supervisory.biz.service.BizCompanyService;
import com.njzscloud.supervisory.project.contant.AuditStatus;
@ -83,15 +82,7 @@ public class BizCompanyController {
}
@GetMapping("/matching")
public R<List<MatchingBizCompanyResult>> matching(
@RequestParam("bizObj") BizObj bizObj,
@RequestParam(value = "filingId", required = false) Long filingId,
@RequestParam(value = "province", required = false) String province,
@RequestParam(value = "city", required = false) String city,
@RequestParam(value = "county", required = false) String county,
@RequestParam(value = "street", required = false) String street,
@RequestParam(value = "lng", required = false) Double lng,
@RequestParam(value = "lat", required = false) Double lat) {
return R.success(bizCompanyService.matching(bizObj, filingId, province, city, county, street, lng, lat));
public R<List<MatchingBizCompanyResult>> matching() {
return R.success(bizCompanyService.matching());
}
}

View File

@ -14,8 +14,5 @@ import java.util.List;
@Mapper
public interface BizCompanyMapper extends BaseMapper<BizCompanyEntity> {
List<MatchingBizCompanyResult> matching(@Param("bizObj") String bizObj,
@Param("filingId") Long filingId,
@Param("userId") Long userId,
@Param("province") String province, @Param("city") String city, @Param("county") String county, @Param("street") String street, @Param("lng") Double lng, @Param("lat") Double lat);
List<MatchingBizCompanyResult> matching(@Param("companyId") Long companyId);
}

View File

@ -1,6 +1,6 @@
package com.njzscloud.supervisory.biz.pojo;
import com.njzscloud.supervisory.user.pojo.AddUserParam;
import com.njzscloud.supervisory.sys.user.pojo.param.AddUserParam;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

View File

@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.core.ex.Exceptions;
import com.njzscloud.common.core.utils.GroupUtil;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.common.security.support.UserDetail;
@ -23,8 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
@ -50,22 +47,6 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
BizCompanyEntity bizCompanyEntity = BeanUtil.copyProperties(addBizCompanyParam, BizCompanyEntity.class);
bizCompanyEntity.setAuditStatus(AuditStatus.DaiShenHe);
this.save(bizCompanyEntity);
BizObj bizObj = addBizCompanyParam.getBizObj();
if (bizObj != BizObj.QingYunGongSi
&& bizObj != BizObj.XiaoNaCang
) return;
Long userId = addBizCompanyParam.getUserId();
Long companyId = bizCompanyEntity.getId();
List<AddBizScopeParam> bizScope = addBizCompanyParam.getScopeList();
for (AddBizScopeParam addBizScopeParam : bizScope) {
addBizScopeParam.setBizObj(bizObj)
.setUserId(userId)
.setCompanyId(companyId);
}
bizScopeService.add(bizScope);
}
/**
@ -191,27 +172,13 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
}
}
public List<MatchingBizCompanyResult> matching(BizObj bizObj, Long filingId,
String province, String city, String county, String street, Double lng, Double lat) {
public List<MatchingBizCompanyResult> matching() {
UserDetail userDetail = SecurityUtil.loginUser();
Long userId = null;
if (userDetail.getBizObj().equals(BizObj.QingYunGongSi.getVal())) {
userId = userDetail.getUserId();
if (userDetail.getBizObj().equals(BizObj.ShiGongDanWei.getVal())) {
return Collections.emptyList();
}
BizCompanyEntity company = this.getOne(Wrappers.lambdaQuery(BizCompanyEntity.class).eq(BizCompanyEntity::getUserId, userDetail.getUserId()));
List<MatchingBizCompanyResult> matchingBizCompanyResults = baseMapper.matching(bizObj.getVal(),
filingId,
userId,
province, city, county, street, lng, lat);
if (matchingBizCompanyResults.isEmpty()) return Collections.emptyList();
List<Long> companyIdList = matchingBizCompanyResults.stream().map(MatchingBizCompanyResult::getId).collect(Collectors.toList());
List<BizScopeEntity> bizScopeEntityList = bizScopeService.list(Wrappers.<BizScopeEntity>lambdaQuery().in(BizScopeEntity::getCompanyId, companyIdList));
Map<Long, List<SearchBizScopeResult>> map = GroupUtil.k_a(bizScopeEntityList, BizScopeEntity::getCompanyId, it -> BeanUtil.copyProperties(it, SearchBizScopeResult.class));
for (MatchingBizCompanyResult matchingBizCompanyResult : matchingBizCompanyResults) {
List<SearchBizScopeResult> bizScopeEntities = map.get(matchingBizCompanyResult.getId());
matchingBizCompanyResult.setScopeList(bizScopeEntities);
}
return matchingBizCompanyResults;
return baseMapper.matching(company.getId());
}
}

View File

@ -14,7 +14,7 @@ import com.njzscloud.supervisory.biz.mapper.BizDriverMapper;
import com.njzscloud.supervisory.biz.pojo.AddDriverParam;
import com.njzscloud.supervisory.biz.pojo.BizDriverEntity;
import com.njzscloud.supervisory.biz.pojo.SearchCompanyResult;
import com.njzscloud.supervisory.user.service.SysUserService;
import com.njzscloud.supervisory.sys.user.service.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -29,7 +29,7 @@ import java.util.List;
@Service
@RequiredArgsConstructor
public class BizDriverService extends ServiceImpl<BizDriverMapper, BizDriverEntity> implements IService<BizDriverEntity> {
private final SysUserService sysUserService;
private final UserService sysUserService;
/**
*
@ -103,12 +103,11 @@ public class BizDriverService extends ServiceImpl<BizDriverMapper, BizDriverEnti
SearchCompanyResult searchCompanyResult = baseMapper.selectCompanyByUserId(userDetail.getUserId());
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizDriverEntity>lambdaQuery()
.eq(BizDriverEntity::getBusy, false)
// .eq(BizDriverEntity::getBusy, false)
.eq(BizDriverEntity::getCompanyId, searchCompanyResult.getId())
.and(StrUtil.isNotBlank(keywords), it ->
it.like(BizDriverEntity::getDriverName, keywords)
.or().like(BizDriverEntity::getPhoneNum, keywords))
));
}
}

View File

@ -105,7 +105,7 @@ public class BizTruckService extends ServiceImpl<BizTruckMapper, BizTruckEntity>
UserDetail userDetail = SecurityUtil.loginUser();
SearchCompanyResult searchCompanyResult = baseMapper.selectCompanyByUserId(userDetail.getUserId());
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizTruckEntity>lambdaQuery()
.eq(BizTruckEntity::getBusy, false)
// .eq(BizTruckEntity::getBusy, false)
.eq(BizTruckEntity::getDisabled, false)
.eq(BizTruckEntity::getAuditStatus, AuditStatus.TongGuo)
.eq(BizTruckEntity::getCompanyId, searchCompanyResult.getId())

View File

@ -5,10 +5,7 @@ import com.njzscloud.common.core.ex.Exceptions;
import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.sys.user.pojo.param.AddUserParam;
import com.njzscloud.supervisory.sys.user.pojo.param.ModifyPasswdParam;
import com.njzscloud.supervisory.sys.user.pojo.param.UserModifyParam;
import com.njzscloud.supervisory.sys.user.pojo.param.UserQueryParam;
import com.njzscloud.supervisory.sys.user.pojo.param.*;
import com.njzscloud.supervisory.sys.user.pojo.result.UserDetailResult;
import com.njzscloud.supervisory.sys.user.service.UserService;
import lombok.RequiredArgsConstructor;
@ -72,6 +69,16 @@ public class UserController {
return R.success(userService.paging(page.toPage(), userQueryParam));
}
/**
*
*
* @param userRegisterParam
*/
@PostMapping("/register")
public R<?> register(@RequestBody @Validated UserRegisterParam userRegisterParam) {
userService.register(userRegisterParam);
return R.success();
}
/**
*
*/

View File

@ -3,6 +3,7 @@ package com.njzscloud.supervisory.sys.user.pojo.param;
import cn.hutool.core.util.StrUtil;
import com.njzscloud.common.mvc.validator.Constrained;
import com.njzscloud.common.mvc.validator.ValidRule;
import com.njzscloud.supervisory.biz.contant.BizObj;
import com.njzscloud.supervisory.sys.user.contant.Gender;
import lombok.Getter;
import lombok.Setter;
@ -17,6 +18,10 @@ import java.util.Set;
@ToString
@Accessors(chain = true)
public class AddUserParam implements Constrained {
/**
* ; biz_obj
*/
private BizObj bizObj;
/**
*
*/

View File

@ -0,0 +1,208 @@
package com.njzscloud.supervisory.sys.user.pojo.param;
import cn.hutool.core.util.StrUtil;
import com.njzscloud.common.mvc.validator.Constrained;
import com.njzscloud.common.mvc.validator.ValidRule;
import com.njzscloud.supervisory.biz.contant.BizObj;
import com.njzscloud.supervisory.sys.user.contant.Gender;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.List;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class UserRegisterParam implements Constrained {
/**
* ; biz_obj
*/
private BizObj bizObj;
/**
*
*/
private String nickname;
/**
*
*/
private String avatar;
/**
* ; gender
*/
private Gender gender;
/**
*
*/
private Account account;
/**
*
*/
private Company company;
@Override
public ValidRule[] rules() {
return new ValidRule[]{
ValidRule.of(() -> StrUtil.isNotBlank(nickname), "用户昵称不能为空"),
ValidRule.of(() -> account != null, "账号信息不能为空"),
};
}
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class Account implements Constrained {
/**
*
*/
private String email;
/**
*
*/
private String phone;
/**
*
*/
private String username;
/**
*
*/
private String secret;
@Override
public ValidRule[] rules() {
return new ValidRule[]{
ValidRule.of(() -> StrUtil.isNotBlank(username), "用户名不能为空"),
ValidRule.of(() -> StrUtil.isNotBlank(secret), "密码不能为空"),
};
}
}
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class Company implements Constrained {
/**
*
*/
private String companyName;
/**
* ; biz_company.uscc
*/
private String uscc;
/**
* ;
*/
private String businessLicense;
/**
* ;
*/
private String certification;
/**
* ; []
*/
private List<String> businessLicenseDate;
/**
* ; []
*/
private List<String> certificationDate;
/**
*
*/
private String legalRepresentative;
/**
* ;
*/
private String province;
/**
* ;
*/
private String city;
/**
* ;
*/
private String county;
/**
*
*/
private String address;
/**
*
*/
private String contacts;
/**
*
*/
private String phoneNum;
/**
*
*/
private List<Scope> scopeList;
@Override
public ValidRule[] rules() {
return new ValidRule[]{};
}
}
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class Scope implements Constrained {
/**
* ;
*/
private String province;
/**
* ;
*/
private String city;
/**
* ;
*/
private String county;
/**
* ;
*/
private String street;
@Override
public ValidRule[] rules() {
return new ValidRule[]{};
}
}
}

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.core.ex.Exceptions;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.common.security.util.SecurityUtil;
import com.njzscloud.supervisory.biz.contant.BizObj;
import com.njzscloud.supervisory.biz.pojo.AddBizCompanyParam;
import com.njzscloud.supervisory.biz.service.BizCompanyService;
import com.njzscloud.supervisory.sys.role.pojo.result.RoleDetailResult;
import com.njzscloud.supervisory.sys.user.contant.Gender;
import com.njzscloud.supervisory.sys.user.mapper.UserMapper;
@ -36,6 +39,8 @@ import java.util.Set;
public class UserService extends ServiceImpl<UserMapper, UserEntity> implements IService<UserEntity> {
private final UserAccountService userAccountService;
private final UserRoleService userRoleService;
private final BizCompanyService bizCompanyService;
/**
*
@ -124,6 +129,34 @@ public class UserService extends ServiceImpl<UserMapper, UserEntity> implements
return PageResult.of(baseMapper.paging(page, ew));
}
/**
*
*
* @param userRegisterParam
*/
@Transactional(rollbackFor = Exception.class)
public void register(UserRegisterParam userRegisterParam) {
AddUserParam addUserParam = BeanUtil.copyProperties(userRegisterParam, AddUserParam.class);
addUserParam.setAccount(BeanUtil.copyProperties(userRegisterParam.getAccount(), AddUserAccountParam.class));
Long userId = this.add(addUserParam);
BizObj bizObj = userRegisterParam.getBizObj();
if (bizObj == BizObj.ZhengFuBuMen
|| bizObj == BizObj.DanWei
|| bizObj == BizObj.GeRen
) return;
UserRegisterParam.Company company = userRegisterParam.getCompany();
Assert.notNull(company, "公司信息不能为空");
AddBizCompanyParam addBizCompanyParam = BeanUtil
.copyProperties(company, AddBizCompanyParam.class)
.setUserId(userId)
.setBizObj(bizObj);
bizCompanyService.add(addBizCompanyParam);
}
/**
*
*/

View File

@ -0,0 +1,18 @@
<?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.njzscloud.supervisory.biz.mapper.BizCompanyMapper">
<resultMap id="matchingMap" autoMapping="true" type="com.njzscloud.supervisory.biz.pojo.MatchingBizCompanyResult">
<result property="bizObj" column="biz_obj" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="businessLicenseDate" column="business_license_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="certificationDate" column="certification_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
</resultMap>
<select id="matching" resultMap="matchingMap">
SELECT *
FROM biz_company a
INNER JOIN biz_contract b ON b.biz_company_id = a.id AND b.biz_company_id = #{companyId}
ORDER BY b.create_time DESC
</select>
</mapper>

View File

@ -0,0 +1,95 @@
<?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.njzscloud.supervisory.biz.mapper.BizContractMapper">
<resultMap id="pagingMap" autoMapping="true" type="com.njzscloud.supervisory.biz.pojo.SearchContractResult">
<result property="contractDate" column="contract_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<association property="companyA" autoMapping="true" javaType="com.njzscloud.supervisory.biz.pojo.SearchCompanyResult">
<result property="id" column="id_a"/>
<result property="userId" column="user_id_a"/>
<result property="bizObj" column="biz_obj_a" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="companyName" column="company_name_a"/>
<result property="businessLicense" column="business_license_a"/>
<result property="certification" column="certification_a"/>
<result property="businessLicenseDate" column="business_license_date_a" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="certificationDate" column="certification_date_a" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="legalRepresentative" column="legal_representative_a"/>
<result property="province" column="province_a"/>
<result property="city" column="city_a"/>
<result property="county" column="county_a"/>
<result property="street" column="street_a"/>
<result property="address" column="address_a"/>
<result property="contacts" column="contacts_a"/>
<result property="phoneNum" column="phone_num_a"/>
<result property="uscc" column="uscc_a"/>
</association>
<association property="companyB" autoMapping="true" javaType="com.njzscloud.supervisory.biz.pojo.SearchCompanyResult">
<result property="id" column="id_b"/>
<result property="userId" column="user_id_b"/>
<result property="bizObj" column="biz_obj_b" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="companyName" column="company_name_b"/>
<result property="businessLicense" column="business_license_b"/>
<result property="certification" column="certification_b"/>
<result property="businessLicenseDate" column="business_license_date_b" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="certificationDate" column="certification_date_b" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="legalRepresentative" column="legal_representative_b"/>
<result property="province" column="province_b"/>
<result property="city" column="city_b"/>
<result property="county" column="county_b"/>
<result property="street" column="street_b"/>
<result property="address" column="address_b"/>
<result property="contacts" column="contacts_b"/>
<result property="phoneNum" column="phone_num_b"/>
<result property="uscc" column="uscc_b"/>
</association>
</resultMap>
<select id="paging" resultMap="pagingMap">
SELECT a.id,
a.user_id,
a.contract,
a.contract_date,
a.memo,
a.create_time,
b.id id_a,
b.user_id user_id_a,
b.biz_obj biz_obj_a,
b.company_name company_name_a,
b.business_license business_license_a,
b.certification certification_a,
b.business_license_date business_license_date_a,
b.certification_date certification_date_a,
b.legal_representative legal_representative_a,
b.province province_a,
b.city city_a,
b.county county_a,
b.street street_a,
b.address address_a,
b.contacts contacts_a,
b.phone_num phone_num_a,
b.uscc uscc_a,
c.id id_b,
c.user_id user_id_b,
c.biz_obj biz_obj_b,
c.company_name company_name_b,
c.business_license business_license_b,
c.certification certification_b,
c.business_license_date business_license_date_b,
c.certification_date certification_date_b,
c.legal_representative legal_representative_b,
c.province province_b,
c.city city_b,
c.county county_b,
c.street street_b,
c.address address_b,
c.contacts contacts_b,
c.phone_num phone_num_b,
c.uscc uscc_b
FROM biz_contract a
INNER JOIN biz_company b ON b.user_id = a.user_id AND b.deleted = 0
INNER JOIN biz_company c ON c.id = a.company_id AND c.deleted = 0
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
</select>
</mapper>

View File

@ -0,0 +1,41 @@
<?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.njzscloud.supervisory.biz.mapper.BizTruckMapper">
<resultMap id="pagingMap" autoMapping="true" type="com.njzscloud.supervisory.biz.pojo.SearchTruckResult">
<result property="truckLicenseDate" column="truck_license_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="qualificationDate" column="qualification_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="certificationDate" column="certification_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
</resultMap>
<select id="paging" resultMap="pagingMap">
SELECT
a.id,
a.user_id,
b.uscc,
a.company_id,
b.company_name,
a.license_plate,
a.truck_license,
a.vn_code,
a.qualification,
a.carrying_capacity,
a.gps,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
a.disabled,
a.audit_status,
a.audit_memo,
a.truck_license_date,
a.qualification_date,
a.certification_date
FROM biz_truck a
INNER JOIN biz_company b ON b.id = a.company_id AND b.deleted = 0
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
</select>
</mapper>

View File

@ -0,0 +1,559 @@
<?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.njzscloud.supervisory.project.mapper.ProjectBookingMapper">
<resultMap id="pagingMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchProjectBookingResult">
<result property="bookingStatus" column="booking_status" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="bizObj" column="biz_obj" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="sitePhotos" column="site_photos" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="dispatchingStatus" column="dispatching_status" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="paging" resultMap="pagingMap">
<if test="bizObj == 'ShiGongDanWei' or bizObj == 'GeRen' or bizObj == 'DanWei'">
SELECT a.id,
a.sn,
a.filing_id,
a.user_id,
a.biz_obj,
a.company_id,
a.company_name,
a.project_name,
a.garbage_category,
a.square,
a.estimate_quantity,
a.contacts,
a.phone_num,
a.site_photos,
a.province,
a.city,
a.county,
a.street,
a.address,
a.lng,
a.lat,
a.booking_time,
a.booking_status,
a.truck_quantity,
a.residue_quantity,
a.dispatching_status,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
b.license_plate,
b.driver_name,
b.phone_num driver_phone_num
FROM project_booking a
LEFT JOIN (SELECT a.booking_id,
b.license_plate,
c.driver_name,
c.phone_num
FROM project_clearance_detail a
INNER JOIN biz_truck b ON b.id = a.truck_id
INNER JOIN biz_driver c ON c.id = a.driver_id) b ON b.booking_id = a.id
</if>
<if test="bizObj == 'QingYunGongSi'">
SELECT id,
sn,
filing_id,
user_id,
biz_obj,
company_id,
company_name,
project_name,
garbage_category,
square,
estimate_quantity,
contacts,
phone_num,
site_photos,
province,
city,
county,
street,
address,
lng,
lat,
booking_time,
booking_status,
truck_quantity,
residue_quantity,
dispatching_status,
creator_id,
modifier_id,
create_time,
modify_time,
deleted,
license_plate,
driver_name,
driver_phone_num
FROM (SELECT a.id,
a.sn,
a.filing_id,
a.user_id,
a.biz_obj,
a.company_id,
a.company_name,
a.project_name,
a.garbage_category,
a.square,
a.estimate_quantity,
a.contacts,
a.phone_num,
a.site_photos,
a.province,
a.city,
a.county,
a.street,
a.address,
a.lng,
a.lat,
a.booking_time,
a.booking_status,
a.truck_quantity,
a.residue_quantity,
a.dispatching_status,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
c.license_plate,
c.driver_name,
c.phone_num driver_phone_num
FROM project_booking a
INNER JOIN project_company b ON b.project_source_id = a.id AND b.project_source = 'YuYue' AND b.company_id = ${companyId} AND b.biz_obj = 'QingYunGongSi'
LEFT JOIN (SELECT a.booking_id,
b.license_plate,
c.driver_name,
c.phone_num
FROM project_clearance_detail a
INNER JOIN biz_truck b ON b.id = a.truck_id
INNER JOIN biz_driver c ON c.id = a.driver_id) c ON c.booking_id = a.id
UNION ALL
SELECT a.id,
a.sn,
a.filing_id,
a.user_id,
a.biz_obj,
a.company_id,
a.company_name,
a.project_name,
a.garbage_category,
a.square,
a.estimate_quantity,
a.contacts,
a.phone_num,
a.site_photos,
a.province,
a.city,
a.county,
a.street,
a.address,
a.lng,
a.lat,
a.booking_time,
a.booking_status,
a.truck_quantity,
a.residue_quantity,
a.dispatching_status,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
c.license_plate,
c.driver_name,
c.phone_num driver_phone_num
FROM project_booking a
INNER JOIN project_company b ON b.project_source_id = a.filing_id AND b.project_source = 'ZhaoBiao' AND b.company_id = ${companyId} AND b.biz_obj = 'QingYunGongSi'
LEFT JOIN (SELECT a.booking_id,
b.license_plate,
c.driver_name,
c.phone_num
FROM project_clearance_detail a
INNER JOIN biz_truck b ON b.id = a.truck_id
INNER JOIN biz_driver c ON c.id = a.driver_id) c ON c.booking_id = a.id
) t
</if>
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
</select>
<select id="getCompanyInfoByUserId" resultType="com.njzscloud.supervisory.biz.pojo.BizCompanyEntity">
SELECT id, company_name, contacts, phone_num
FROM biz_company
WHERE user_id = #{userId}
AND deleted = 0
</select>
<resultMap id="statisticsCompanyCountMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="biz_obj" property="bizObj"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="company_count" property="companyCount"/>
</resultMap>
<select id="statisticsCompanyCount" resultMap="statisticsCompanyCountMap">
SELECT biz_obj, COUNT(*) company_count
FROM biz_company
WHERE deleted = 0
GROUP BY biz_obj
</select>
<select id="statisticsDaiShenHeCompanyCount" resultMap="statisticsCompanyCountMap">
SELECT 'ShiGongDanWei' AS biz_obj, COUNT(bc.biz_obj) AS company_count
FROM biz_company bc
WHERE bc.deleted = 0
AND bc.audit_status = 'DaiShenHe'
AND bc.biz_obj = 'ShiGongDanWei'
UNION ALL
SELECT 'QingYunGongSi' AS biz_obj, COUNT(bc.biz_obj) AS company_count
FROM biz_company bc
WHERE bc.deleted = 0
AND bc.audit_status = 'DaiShenHe'
AND bc.biz_obj = 'QingYunGongSi'
UNION ALL
SELECT 'XiaoNaCang' AS biz_obj, COUNT(bc.biz_obj) AS company_count
FROM biz_company bc
WHERE bc.deleted = 0
AND bc.audit_status = 'DaiShenHe'
AND bc.biz_obj = 'XiaoNaCang';
</select>
<resultMap id="statisticsProjectCountMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="project_source" property="projectSource"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="project_count" property="projectCount"/>
</resultMap>
<select id="statisticsProjectCount" resultMap="statisticsProjectCountMap">
SELECT project_source, COUNT(*) project_count
FROM (SELECT IF(filing_id IS NULL, 'YuYue', 'ZhaoBiao') project_source
FROM project_booking
WHERE deleted = 0) t
GROUP BY project_source
</select>
<resultMap id="statisticsScopeCountMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="scope" property="scope"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="scope_count" property="scopeCount"/>
</resultMap>
<select id="statisticsScopeCount" resultMap="statisticsScopeCountMap">
SELECT scope, COUNT(*) scope_count
FROM (SELECT CONCAT(IFNULL(province, ''),
IFNULL(city, ''),
IFNULL(county, ''),
IFNULL(street, '')) scope
FROM project_booking
WHERE deleted = 0) t
GROUP BY t.scope
</select>
<resultMap id="statisticsWeightTruckMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="total_weight" property="totalWeight" javaType="java.lang.Integer"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="total_truck" property="totalTruck" javaType="java.lang.Integer"/>
</resultMap>
<select id="statisticsWeightTruck" resultMap="statisticsWeightTruckMap">
SELECT MAX(CASE WHEN t = 1 THEN c ELSE 0 END) total_weight,
MAX(CASE WHEN t = 2 THEN c ELSE 0 END) total_truck
FROM (SELECT 1 t, CAST(SUM(suttle_weight) AS SIGNED) c
FROM project_clearance_detail
WHERE suttle_weight IS NOT NULL
UNION ALL
SELECT 2 t, COUNT(*) c
FROM biz_truck
WHERE deleted = 0) t
</select>
<resultMap id="statisticsWeightMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="d" property="date"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="w" property="totalWeight"/>
</resultMap>
<select id="statisticsWeight" resultMap="statisticsWeightMap">
SELECT all_dates.d, IFNULL(SUM(pcd.suttle_weight), 0) w
FROM (SELECT CURDATE() - INTERVAL 6 DAY AS d
UNION ALL
SELECT CURDATE() - INTERVAL 5 DAY
UNION ALL
SELECT CURDATE() - INTERVAL 4 DAY
UNION ALL
SELECT CURDATE() - INTERVAL 3 DAY
UNION ALL
SELECT CURDATE() - INTERVAL 2 DAY
UNION ALL
SELECT CURDATE() - INTERVAL 1 DAY
UNION ALL
SELECT CURDATE()) all_dates
LEFT JOIN project_clearance_detail pcd
ON all_dates.d = DATE(pcd.out_time)
AND pcd.suttle_weight IS NOT NULL
GROUP BY all_dates.d
ORDER BY all_dates.d
</select>
<resultMap id="searchBill" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchBillResult">
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="clearanceStatus" column="clearance_status" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="photos" column="photos" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="sitePhotos" column="site_photos" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
</resultMap>
<select id="searchBill" resultMap="searchBill">
SELECT t.id,
t.sn,
t.garbage_category,
t.clearance_status,
t.start_time,
t.end_time,
t.bill_sn,
t.in_time,
t.out_time,
t.in_weight,
t.out_weight,
t.suttle_weight,
t.photos,
t.producing_id,
e.company_name producing_name,
e.contacts producing_contacts,
e.phone_num producing_phone_num,
t.clearance_company_id,
t.clearance_company_name,
t.clearance_contacts,
t.clearance_phone_num,
t.consumption_company_id,
t.consumption_company_name,
t.consumption_contacts,
t.consumption_phone_num,
e.sn booking_sn,
e.project_name,
e.booking_time,
t.dispatching_time,
e.province,
e.city,
e.county,
e.street,
e.address,
e.lng,
e.lat,
e.site_photos,
t.license_plate,
t.carrying_capacity,
t.driver_name,
t.driver_phone_num
FROM project_booking e
LEFT JOIN (SELECT a.booking_id,
a.id,
a.sn,
a.garbage_category,
a.clearance_status,
a.start_time,
a.end_time,
a.bill_sn,
a.in_time,
a.out_time,
a.in_weight,
a.out_weight,
a.suttle_weight,
a.photos,
a.producing_id,
a.clearance_company_id,
c.company_name clearance_company_name,
c.contacts clearance_contacts,
c.phone_num clearance_phone_num,
a.consumption_company_id,
d.company_name consumption_company_name,
d.contacts consumption_contacts,
d.phone_num consumption_phone_num,
a.dispatching_time,
f.license_plate,
f.carrying_capacity,
g.driver_name,
g.phone_num driver_phone_num
FROM project_clearance_detail a
INNER JOIN sys_user b ON b.id = a.producing_id AND b.deleted = 0
INNER JOIN biz_company c ON c.id = a.clearance_company_id AND c.deleted = 0
INNER JOIN biz_company d ON d.id = a.consumption_company_id AND d.deleted = 0
INNER JOIN biz_truck f ON f.id = a.truck_id AND f.deleted = 0
INNER JOIN biz_driver g ON g.id = a.driver_id AND g.deleted = 0
WHERE a.biz_obj IN ('DanWei', 'GeRen')
UNION ALL
SELECT a.booking_id,
a.id,
a.sn,
a.garbage_category,
a.clearance_status,
a.start_time,
a.end_time,
a.bill_sn,
a.in_time,
a.out_time,
a.in_weight,
a.out_weight,
a.suttle_weight,
a.photos,
a.producing_id,
a.clearance_company_id,
c.company_name clearance_company_name,
c.contacts clearance_contacts,
c.phone_num clearance_phone_num,
a.consumption_company_id,
d.company_name consumption_company_name,
d.contacts consumption_contacts,
d.phone_num consumption_phone_num,
a.dispatching_time,
f.license_plate,
f.carrying_capacity,
g.driver_name,
g.phone_num driver_phone_num
FROM project_clearance_detail a
INNER JOIN biz_company b ON b.id = a.producing_id AND b.deleted = 0
INNER JOIN biz_company c ON c.id = a.clearance_company_id AND c.deleted = 0
INNER JOIN biz_company d ON d.id = a.consumption_company_id AND d.deleted = 0
INNER JOIN biz_truck f ON f.id = a.truck_id AND f.deleted = 0
INNER JOIN biz_driver g ON g.id = a.driver_id AND g.deleted = 0
WHERE a.biz_obj = 'ShiGongDanWei') t ON e.id = t.booking_id
WHERE e.deleted = 0
AND e.id = #{bookingId}
</select>
<resultMap id="statisticsGarbageCategoryMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="garbage_category" property="garbageCategory"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="suttle_weight" property="clearanceQuantity"/>
</resultMap>
<select id="statisticsGarbageCategory" resultMap="statisticsGarbageCategoryMap">
SELECT CASE garbage_category
WHEN 'ChaiQianLaJi' THEN '拆迁垃圾'
WHEN 'YuanLinLaJi' THEN '园林垃圾'
WHEN 'ChenFuLaJi' THEN '陈腐垃圾'
WHEN 'ZhuangXiuLaJi' THEN '装修垃圾'
ELSE '' END garbage_category,
suttle_weight
FROM (SELECT 'ChaiQianLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NOT NULL
WHERE bc.garbage_category = 'ChaiQianLaJi'
UNION ALL
SELECT 'ChenFuLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NOT NULL
WHERE bc.garbage_category = 'ChenFuLaJi'
UNION ALL
SELECT 'ZhuangXiuLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NOT NULL
WHERE bc.garbage_category = 'ZhuangXiuLaJi'
UNION ALL
SELECT 'YuanLinLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NOT NULL
WHERE bc.garbage_category = 'YuanLinLaJi') t
</select>
<select id="statisticsGarbageCategoryNoProject" resultMap="statisticsGarbageCategoryMap">
SELECT CASE garbage_category
WHEN 'ChaiQianLaJi' THEN '拆迁垃圾'
WHEN 'YuanLinLaJi' THEN '园林垃圾'
WHEN 'ChenFuLaJi' THEN '陈腐垃圾'
WHEN 'ZhuangXiuLaJi' THEN '装修垃圾'
ELSE '' END garbage_category,
suttle_weight
FROM (SELECT 'ChaiQianLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NULL
WHERE bc.garbage_category = 'ChaiQianLaJi'
UNION ALL
SELECT 'ChenFuLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NULL
WHERE bc.garbage_category = 'ChenFuLaJi'
UNION ALL
SELECT 'ZhuangXiuLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NULL
WHERE bc.garbage_category = 'ZhuangXiuLaJi'
UNION ALL
SELECT 'YuanLinLaJi' AS garbage_category, IFNULL(SUM(suttle_weight), 0) suttle_weight
FROM project_clearance_detail bc
INNER JOIN project_booking b ON b.id = bc.booking_id AND b.deleted = 0 AND b.filing_id IS NULL
WHERE bc.garbage_category = 'YuanLinLaJi') t
</select>
<resultMap id="statisticsMonthClearanceQuantityMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="m" property="month"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="w" property="clearanceQuantity"/>
</resultMap>
<select id="statisticsMonthClearanceQuantity" resultMap="statisticsMonthClearanceQuantityMap">
SELECT a.m,
IFNULL(SUM(b.suttle_weight), 0) w
FROM (SELECT 1 m
UNION ALL
SELECT 2 m
UNION ALL
SELECT 3 m
UNION ALL
SELECT 4 m
UNION ALL
SELECT 5 m
UNION ALL
SELECT 6 m
UNION ALL
SELECT 7 m
UNION ALL
SELECT 8 m
UNION ALL
SELECT 9 m
UNION ALL
SELECT 10 m
UNION ALL
SELECT 11 m
UNION ALL
SELECT 12 m) a
LEFT JOIN project_clearance_detail b ON MONTH(b.out_time) = a.m AND YEAR(b.out_time) = ${year}
WHERE a.m BETWEEN 1 AND ${month}
GROUP BY a.m
ORDER BY a.m
</select>
<resultMap id="statisticsProjectClearanceQuantityMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="project_name" property="projectName"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="total_quantity" property="totalQuantity"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="clearance_quantity" property="clearanceQuantity"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="surplus_quantity" property="surplusQuantity"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="ratio" property="ratio"/>
</resultMap>
<select id="statisticsProjectClearanceQuantity" resultMap="statisticsProjectClearanceQuantityMap">
SELECT a.project_name,
total_quantity,
clearance_quantity,
surplus_quantity,
ROUND(ratio, 2) ratio
FROM project_filing a
INNER JOIN (SELECT a.id,
total_quantity,
IFNULL(clearance_quantity, 0) clearance_quantity,
(total_quantity - IFNULL(clearance_quantity, 0)) surplus_quantity,
((IFNULL(clearance_quantity, 0) / total_quantity) * 100) ratio
FROM (SELECT id, IFNULL(SUM(estimate_quantity), 0) total_quantity
FROM project_filing
GROUP BY id) a
LEFT JOIN (SELECT c.id,
IFNULL(SUM(a.suttle_weight), 0) clearance_quantity
FROM project_clearance_detail a
INNER JOIN project_booking b ON b.id = a.booking_id AND b.deleted = 0 AND b.filing_id IS NOT NULL
INNER JOIN project_filing c ON c.id = b.filing_id AND c.deleted = 0
GROUP BY c.id) b ON b.id = a.id) b ON b.id = a.id
</select>
</mapper>

View File

@ -0,0 +1,74 @@
<?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.njzscloud.supervisory.project.mapper.ProjectCompanyMapper">
<resultMap id="selectCompanyByProjectSourceIdMap" type="com.njzscloud.supervisory.project.pojo.SearchProjectCompanyResult">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="bizObj" column="biz_obj" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="companyName" column="company_name"/>
<result property="businessLicense" column="business_license"/>
<result property="certification" column="certification"/>
<result property="businessLicenseDate" column="business_license_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="certificationDate" column="certification_date" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="legalRepresentative" column="legal_representative"/>
<result property="province" column="province"/>
<result property="city" column="city"/>
<result property="county" column="county"/>
<result property="street" column="street"/>
<result property="address" column="address"/>
<result property="contacts" column="contacts"/>
<result property="phoneNum" column="phone_num"/>
</resultMap>
<select id="selectCompanyByProjectSourceId" resultMap="selectCompanyByProjectSourceIdMap">
SELECT a.id,
a.user_id,
a.biz_obj,
a.company_name,
a.business_license,
a.certification,
a.business_license_date,
a.certification_date,
a.legal_representative,
a.province,
a.city,
a.county,
a.street,
a.address,
a.lng,
a.lat,
a.contacts,
a.phone_num,
a.audit_status
FROM biz_company a
INNER JOIN project_company b ON a.id = b.company_id AND b.project_source_id = #{projectSourceId}
WHERE a.deleted = 0
</select>
<select id="selectCompanyByProjectId"
resultType="com.njzscloud.supervisory.project.pojo.SearchProjectCompanyResult">
SELECT a.id,
a.user_id,
a.biz_obj,
a.company_name,
a.business_license,
a.certification,
a.business_license_date,
a.certification_date,
a.legal_representative,
a.province,
a.city,
a.county,
a.street,
a.address,
a.lng,
a.lat,
a.contacts,
a.phone_num,
a.audit_status
FROM biz_company a
INNER JOIN project_company b ON a.id = b.company_id AND b.project_id = #{projectId}
WHERE a.deleted = 0
</select>
</mapper>

View File

@ -0,0 +1,43 @@
<?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.njzscloud.supervisory.project.mapper.ProjectFilingMapper">
<resultMap id="pagingMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchProjectFilingResult">
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="auditStatus" column="audit_status" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="paging" resultMap="pagingMap">
SELECT a.id,
a.user_id,
a.project_name,
a.garbage_category,
a.estimate_quantity,
a.province,
a.city,
a.county,
a.street,
a.address,
a.lng,
a.lat,
a.contract,
a.audit_status,
a.start_date,
a.end_date,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
a.audit_memo,
a.contacts,
a.phone_num,
b.company_name,
b.lng company_lng,
b.lat company_lat
FROM project_filing a
LEFT JOIN biz_company b ON b.user_id = a.user_id AND b.deleted = 0
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
</select>
</mapper>

View File

@ -0,0 +1,465 @@
<?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.njzscloud.supervisory.project.mapper.ProjectInfoMapper">
<resultMap id="pagingMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchProjectInfoResult">
<result property="projectSource" column="project_source" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="progressStage" column="progress_stage" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="paging" resultMap="pagingMap">
<if test="bizObj == 'ShiGongDanWei'">
SELECT
a.id,
a.sn,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted
FROM project_info a
INNER JOIN project_filing b ON b.id = a.project_source_id AND b.user_id = #{userId} AND b.deleted = 0
WHERE a.project_source = 'ZhaoBiao'
AND a.deleted = 0
</if>
<if test="bizObj == 'QingYunGongSi'">
SELECT a.id,
a.sn,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.create_time
FROM (
SELECT a.id,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.sn,
c.biz_obj,
'' company_name,
b.contacts,
b.phone_num,
b.create_time
FROM project_info a
INNER JOIN project_booking b ON b.id = a.project_source_id AND b.deleted = 0
INNER JOIN sys_user c ON c.id = b.user_id AND c.deleted = 0
WHERE a.deleted = 0
UNION ALL
SELECT a.id,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.sn,
c.biz_obj,
c.company_name,
c.contacts,
c.phone_num,
b.create_time
FROM project_info a
INNER JOIN project_filing b ON b.id = a.project_source_id AND b.deleted = 0
INNER JOIN biz_company c ON c.user_id = b.user_id AND c.deleted = 0
WHERE a.deleted = 0) a
INNER JOIN (SELECT a.project_id
FROM project_company a
INNER JOIN biz_company b ON b.id = a.company_id AND b.user_id = ${userId} AND b.deleted = 0
WHERE a.biz_obj = 'QingYunGongSi') b ON b.project_id = a.id
</if>
</select>
<resultMap id="searchABillResultMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchABillResult">
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="searchABillResult" resultMap="searchABillResultMap">
SELECT sn,
project_name,
province,
city,
county,
street,
address,
contacts,
phone_num,
garbage_category,
start_date,
end_date
FROM project_info
</select>
<resultMap id="searchBBillResultMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchBBillResult">
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="searchBBillResult" resultMap="searchBBillResultMap">
SELECT a.sn,
a.license_plate,
a.driver_name,
a.driver_phone_num,
a.garbage_category,
a.suttle_weight,
a.start_time,
a.end_time,
b.project_name,
b.province,
b.city,
b.county,
b.street,
b.address,
b.contacts,
b.phone_num,
c.company_name consumption_company_name
FROM project_clearance_detail a
INNER JOIN project_info b ON a.project_id = b.id AND b.deleted = 0
INNER JOIN biz_company c ON a.consumption_company_id = c.id AND c.deleted = 0
</select>
<resultMap id="searchCBillResultMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchCBillResult">
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="searchCBillResult" resultMap="searchCBillResultMap">
SELECT a.sn,
a.license_plate,
a.driver_name,
a.driver_phone_num,
a.garbage_category,
a.suttle_weight,
a.start_time,
a.end_time,
b.project_name,
b.province,
b.city,
b.county,
b.street,
b.address,
b.contacts,
b.phone_num,
c.company_name consumption_company_name
FROM project_clearance_detail a
INNER JOIN project_info b ON a.project_id = b.id AND b.deleted = 0
INNER JOIN biz_company c ON a.consumption_company_id = c.id AND c.deleted = 0
</select>
<resultMap id="statisticsCompanyCountMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="biz_obj" property="bizObj"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="company_count" property="companyCount"/>
</resultMap>
<select id="statisticsCompanyCount" resultMap="statisticsCompanyCountMap">
SELECT biz_obj, COUNT(*) company_count
FROM biz_company
WHERE deleted = 0
GROUP BY biz_obj
</select>
<select id="statisticsDaiShenHeCompanyCount" resultMap="statisticsCompanyCountMap">
SELECT biz_obj, COUNT(*) company_count
FROM biz_company
WHERE deleted = 0
AND audit_status = 'DaiShenHe'
GROUP BY biz_obj
</select>
<resultMap id="statisticsProjectCountMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="project_source" property="projectSource"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="project_count" property="projectCount"/>
</resultMap>
<select id="statisticsProjectCount" resultMap="statisticsProjectCountMap">
SELECT project_source, COUNT(*) project_count
FROM project_info
WHERE deleted = 0
GROUP BY project_source
</select>
<resultMap id="statisticsScopeCountMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="scope" property="scope"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="scope_count" property="scopeCount"/>
</resultMap>
<select id="statisticsScopeCount" resultMap="statisticsScopeCountMap">
SELECT scope, COUNT(*) scope_count
FROM (SELECT CONCAT(IFNULL(province, ''),
IFNULL(city, ''),
IFNULL(county, ''),
IFNULL(street, '')) scope
FROM project_info
WHERE deleted = 0) t
GROUP BY t.scope
</select>
<resultMap id="statisticsWeightTruckMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="total_weight" property="totalWeight" javaType="java.lang.Integer"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="total_truck" property="totalTruck" javaType="java.lang.Integer"/>
</resultMap>
<select id="statisticsWeightTruck" resultMap="statisticsWeightTruckMap">
SELECT MAX(CASE WHEN t = 1 THEN c ELSE 0 END) total_weight,
MAX(CASE WHEN t = 2 THEN c ELSE 0 END) total_truck
FROM (SELECT 1 t, CAST(SUM(suttle_weight) AS SIGNED) c
FROM project_clearance_detail
WHERE suttle_weight IS NOT NULL
UNION ALL
SELECT 2 t, COUNT(*) c
FROM biz_truck
WHERE deleted = 0) t
</select>
<resultMap id="statisticsWeightMap" type="hashmap">
<!--suppress MybatisXMapperXmlInspection -->
<result column="d" property="date"/>
<!--suppress MybatisXMapperXmlInspection -->
<result column="w" property="totalWeight"/>
</resultMap>
<select id="statisticsWeight" resultMap="statisticsWeightMap">
SELECT DATE(out_time) d, SUM(suttle_weight) w
FROM project_clearance_detail
WHERE suttle_weight IS NOT NULL
AND out_time >= DATE_SUB(CURDATE(), INTERVAL 6 DAY)
GROUP BY DATE(out_time)
ORDER BY DATE(out_time)
</select>
<resultMap id="searchBill" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchBillResult">
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<association property="company" autoMapping="true" javaType="com.njzscloud.supervisory.biz.pojo.SearchCompanyResult">
<result property="bizObj" column="biz_obj" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="companyName" column="company_name"/>
<result property="contacts" column="contacts"/>
<result property="phoneNum" column="phone_num"/>
</association>
<association property="companyA" autoMapping="true" javaType="com.njzscloud.supervisory.biz.pojo.SearchCompanyResult">
<result property="bizObj" column="biz_obj_a" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="companyName" column="company_name_a"/>
<result property="contacts" column="contacts_a"/>
<result property="phoneNum" column="phone_num_a"/>
</association>
<association property="companyB" autoMapping="true" javaType="com.njzscloud.supervisory.biz.pojo.SearchCompanyResult">
<result property="bizObj" column="biz_obj_b" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="companyName" column="company_name_b"/>
<result property="contacts" column="contacts_b"/>
<result property="phoneNum" column="phone_num_b"/>
</association>
</resultMap>
<select id="searchBill" resultMap="searchBill">
SELECT a.sn,
a.license_plate,
a.driver_name,
a.driver_phone_num,
a.garbage_category,
a.suttle_weight,
a.start_time,
a.end_time,
b.sn project_sn,
b.project_name,
b.province,
b.city,
b.county,
b.street,
b.address,
b.biz_obj biz_obj,
b.company_name company_name,
b.contacts contacts,
b.phone_num phone_num,
b.start_date project_start_date,
b.end_date project_end_date,
d.biz_obj biz_obj_a,
d.company_name company_name_a,
d.contacts contacts_a,
d.phone_num phone_num_a,
c.biz_obj biz_obj_b,
c.company_name company_name_b,
c.contacts contacts_b,
c.phone_num phone_num_b
FROM project_clearance_detail a
INNER JOIN (SELECT a.id,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.sn,
c.biz_obj,
'' company_name,
b.contacts,
b.phone_num
FROM project_info a
INNER JOIN project_booking b ON b.id = a.project_source_id AND b.deleted = 0
INNER JOIN sys_user c ON c.id = b.user_id AND c.deleted = 0
WHERE a.deleted = 0
UNION ALL
SELECT a.id,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.sn,
c.biz_obj,
c.company_name,
c.contacts,
c.phone_num
FROM project_info a
INNER JOIN project_filing b ON b.id = a.project_source_id AND b.deleted = 0
INNER JOIN biz_company c ON c.user_id = b.user_id AND c.deleted = 0
WHERE a.deleted = 0) b ON a.project_id = b.id
INNER JOIN biz_company c ON a.consumption_company_id = c.id AND c.deleted = 0
INNER JOIN biz_company d ON a.clearance_company_id = d.id AND d.deleted = 0
WHERE a.id = #{clearanceDetailId}
</select>
<resultMap id="detailMap" autoMapping="true" type="com.njzscloud.supervisory.project.pojo.SearchProjectInfoResult">
<result property="projectSource" column="project_source" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="garbageCategory" column="garbage_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="progressStage" column="progress_stage" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<select id="detail" resultMap="detailMap">
SELECT a.id,
a.sn,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
c.company_name,
c.contacts,
c.phone_num
FROM project_info a
INNER JOIN project_filing b ON b.id = a.project_source_id AND b.deleted = 0
INNER JOIN biz_company c ON b.user_id = c.user_id AND c.deleted = 0
WHERE a.id = #{id}
AND a.deleted = 0
UNION ALL
SELECT a.id,
a.sn,
a.project_source,
a.project_source_id,
a.project_name,
a.province,
a.city,
a.county,
a.street,
a.address,
a.garbage_category,
a.estimate_quantity,
a.contract,
a.site_photos,
a.start_date,
a.end_date,
a.progress_stage,
a.truck_quantity,
a.dispatching_status,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.deleted,
b.company_name,
b.contacts,
b.phone_num
FROM project_info a
INNER JOIN project_booking b ON b.id = a.project_source_id AND b.deleted = 0
WHERE a.id = #{id}
AND a.deleted = 0
</select>
</mapper>

View File

@ -8,6 +8,7 @@
a.secret,
b.nickname,
b.tenant_id,
b.biz_obj,
c.tenant_name,
a.disabled
FROM sys_user_account a