first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
|
||||
// .::::.
|
||||
// .::::::::.
|
||||
// :::::::::::
|
||||
// ..:::::::::::'
|
||||
// '::::::::::::'
|
||||
// .::::::::::
|
||||
// '::::::::::::::..
|
||||
// ..::::::::::::.
|
||||
// ``::::::::::::::::
|
||||
// ::::``:::::::::' .:::.
|
||||
// ::::' ':::::' .::::::::.
|
||||
// .::::' :::: .:::::::'::::.
|
||||
// .:::' ::::: .:::::::::' ':::::.
|
||||
// .::' :::::.:::::::::' ':::::.
|
||||
// .::' ::::::::::::::' ``::::.
|
||||
// ...::: ::::::::::::' ``::.
|
||||
// ```` ':. ':::::::::' ::::..
|
||||
// '.:::::' ':'````..
|
||||
//
|
||||
@@ -0,0 +1,40 @@
|
||||
server:
|
||||
port: 8007
|
||||
management:
|
||||
metrics:
|
||||
web:
|
||||
server:
|
||||
request:
|
||||
autotime:
|
||||
enabled: false
|
||||
spring:
|
||||
application:
|
||||
name: mhd-userCenter-service
|
||||
profiles:
|
||||
active: dev
|
||||
main:
|
||||
allow-circular-references: true
|
||||
# nacos配置
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
#server-addr: 192.168.0.69:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
#server-addr: 116.204.23.92:8848
|
||||
namespace: 4dd3256a-22c0-42db-9af1-de513a05c6a9
|
||||
config:
|
||||
# 配置中心地址
|
||||
#server-addr: 192.168.0.69:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
#server-addr: 116.204.23.92:8848
|
||||
# 锁定server端的配置文件(读取它的配置项)
|
||||
namespace: 4dd3256a-22c0-42db-9af1-de513a05c6a9
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
file-extension: yml #默认properties
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 50MB
|
||||
max-request-size: 50MB
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/mhd-user-center" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.mhd" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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.mhd.user.domain.appLocation.repository.mapper.AppLocationMapper">
|
||||
|
||||
<resultMap type="com.mhd.user.domain.appLocation.repository.po.AppLocationPO" id="AppLocationResult">
|
||||
<result property="appLocationId" column="app_location_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="longitude" column="longitude" />
|
||||
<result property="latitude" column="latitude" />
|
||||
<result property="speed" column="speed" />
|
||||
<result property="address" column="address" />
|
||||
<result property="waybillNum" column="waybill_num" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectAppLocationPo">
|
||||
select app_location_id, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, user_id, longitude, latitude, speed, address, waybill_num from app_location
|
||||
</sql>
|
||||
|
||||
<sql id="selectAppLocationPo1">
|
||||
<where>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="longitude != null and longitude != ''">
|
||||
and longitude = #{longitude}
|
||||
</if>
|
||||
<if test="latitude != null and latitude != ''">
|
||||
and latitude = #{latitude}
|
||||
</if>
|
||||
<if test="speed != null ">
|
||||
and speed = #{speed}
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
and address = #{address}
|
||||
</if>
|
||||
<if test="waybillNum != null and waybillNum != ''">
|
||||
and waybill_num = #{waybillNum}
|
||||
</if>
|
||||
<if test="licensePlate != null and licensePlate != ''">
|
||||
and license_plate = #{licensePlate}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND create_time BETWEEN #{startTime} and #{endTime}
|
||||
</if>
|
||||
|
||||
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.appLocation.repository.todo.AppLocationDO" resultMap="AppLocationResult">
|
||||
<include refid="selectAppLocationPo"/>
|
||||
<include refid="selectAppLocationPo1"/>
|
||||
order by create_time asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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.mhd.user.domain.roleAggregate.repository.mapper.CustomAuthRoleMapper">
|
||||
|
||||
<sql id="selectRoleMenuVo">
|
||||
SELECT
|
||||
a.custom_auth_role_id,
|
||||
a.menu_id,
|
||||
a.role_id,
|
||||
a.table_json,
|
||||
a.form_json,
|
||||
a.button_json,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name
|
||||
FROM
|
||||
`custom_auth_role` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<select id="getCustomAuthByRoleOrUserId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthRoleDO"
|
||||
resultType="com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO">
|
||||
<include refid="selectRoleMenuVo"/>
|
||||
<include refid="common_where"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getCustomAuthMenuByRoleOrUserId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthRoleDO"
|
||||
resultType="com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO">
|
||||
<include refid="selectRoleMenuVo"/>
|
||||
<include refid="common_where"/>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="deleteCustomAuthRoleByRoleId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO">
|
||||
DELETE
|
||||
FROM
|
||||
`custom_auth_role` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and a.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="menuId !=null and menuId !='' ">
|
||||
and a.menu_id = #{menuId}
|
||||
</if>
|
||||
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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.mhd.user.domain.roleAggregate.repository.mapper.CustomAuthUserMapper">
|
||||
|
||||
<sql id="selectRoleMenuVo">
|
||||
SELECT
|
||||
a.custom_auth_user_id,
|
||||
a.menu_id,
|
||||
a.user_id,
|
||||
a.table_json,
|
||||
a.form_json,
|
||||
a.button_json,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name
|
||||
FROM
|
||||
`custom_auth_user` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<select id="getCustomAuthByRoleOrUserId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO"
|
||||
resultType="com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO">
|
||||
<include refid="selectRoleMenuVo"/>
|
||||
<include refid="common_where"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getCustomAuthMenuByRoleOrUserId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO"
|
||||
resultType="com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO">
|
||||
<include refid="selectRoleMenuVo"/>
|
||||
<include refid="common_where"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="deleteCustomAuthUserByUserId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO">
|
||||
DELETE
|
||||
FROM
|
||||
`custom_auth_user` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
<select id="getCustomAuthByRoleId"
|
||||
resultType="com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO">
|
||||
select *
|
||||
from custom_auth_role a
|
||||
where a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
</if>
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and a.role_id = #{roleId}
|
||||
</if>
|
||||
|
||||
<if test="menuId !=null and menuId !='' ">
|
||||
and a.menu_id = #{menuId}
|
||||
</if>
|
||||
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?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.mhd.user.domain.driverCurrentPosition.repository.mapper.DriverCurrentPositionMapper">
|
||||
|
||||
<resultMap type="com.mhd.common.core.domain.DriverCurrentPositionPO" id="DriverCurrentPositionResult">
|
||||
<result property="driverCurrentPositionId" column="driver_current_position_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="longitude" column="longitude" />
|
||||
<result property="latitude" column="latitude" />
|
||||
<result property="address" column="address" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectDriverCurrentPositionPo">
|
||||
select driver_current_position_id, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, user_id, longitude, latitude, address from driver_current_position
|
||||
</sql>
|
||||
|
||||
<sql id="selectDriverCurrentPositionPo1">
|
||||
<where>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="longitude != null and longitude != ''">
|
||||
and longitude = #{longitude}
|
||||
</if>
|
||||
<if test="latitude != null and latitude != ''">
|
||||
and latitude = #{latitude}
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
and address = #{address}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO" resultMap="DriverCurrentPositionResult">
|
||||
<include refid="selectDriverCurrentPositionPo"/>
|
||||
<include refid="selectDriverCurrentPositionPo1"/>
|
||||
</select>
|
||||
<select id="getDriverLatestLocation"
|
||||
resultType="com.mhd.common.core.domain.DriverCurrentPositionPO">
|
||||
SELECT *
|
||||
FROM driver_current_position
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY create_by DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="getOnlineDriver" resultType="java.lang.Long">
|
||||
SELECT
|
||||
u.user_id
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
IF
|
||||
( a.createTime >= #{time}, 1, 0 ) excTime,
|
||||
a.createTime,
|
||||
a.user_id
|
||||
FROM
|
||||
( SELECT MAX( create_time ) createTime, user_id FROM `driver_current_position` GROUP BY user_id ) a
|
||||
) u
|
||||
WHERE
|
||||
u.excTime = 1
|
||||
</select>
|
||||
<select id="getOnlineVehicle" resultType="com.mhd.common.core.domain.DriverCurrentPositionPO">
|
||||
SELECT
|
||||
MAX( create_time ) createTime,
|
||||
user_id,
|
||||
address,
|
||||
license_plate
|
||||
FROM
|
||||
`driver_current_position`
|
||||
WHERE
|
||||
create_Time >= #{time}
|
||||
AND license_plate IS NOT NULL
|
||||
GROUP BY
|
||||
user_id
|
||||
</select>
|
||||
<select id="getOfflineVehicle" resultType="com.mhd.common.core.domain.DriverCurrentPositionPO">
|
||||
SELECT
|
||||
MAX( create_time ) createTime,
|
||||
user_id,
|
||||
address,
|
||||
license_plate
|
||||
FROM
|
||||
`driver_current_position`
|
||||
WHERE
|
||||
create_Time <![CDATA[<]]> #{time}
|
||||
AND license_plate IS NOT NULL
|
||||
GROUP BY
|
||||
user_id
|
||||
</select>
|
||||
<select id="getVehicleLatestLocation" resultType="com.mhd.common.core.domain.DriverCurrentPositionPO">
|
||||
SELECT a.*,
|
||||
b.user_name,
|
||||
b.user_phone
|
||||
FROM driver_current_position a
|
||||
left join user b on a.user_id = b.user_id
|
||||
WHERE license_plate = #{licensePlate}
|
||||
ORDER BY create_by DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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.mhd.user.domain.driverFollowShipper.repository.mapper.DriverFollowShipperMapper">
|
||||
|
||||
<resultMap type="com.mhd.user.domain.driverFollowShipper.repository.po.DriverFollowShipperPO" id="DriverFollowShipperResult">
|
||||
<result property="driverFollowShipperId" column="driver_follow_shipper_id" />
|
||||
<result property="driverUserId" column="driver_user_id" />
|
||||
<result property="shipperUserId" column="shipper_user_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="organizationId" column="organization_id" />
|
||||
<result property="organizationName" column="organization_name" />
|
||||
<result property="topOrganizationId" column="top_organization_id" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectDriverFollowShipperPo">
|
||||
select driver_follow_shipper_id, driver_user_id, shipper_user_id, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, organization_id, organization_name, top_organization_id from driver_follow_shipper
|
||||
</sql>
|
||||
|
||||
<sql id="selectDriverFollowShipperPo1">
|
||||
<where>
|
||||
<if test="driverUserId != null ">
|
||||
and driver_user_id = #{driverUserId}
|
||||
</if>
|
||||
<if test="shipperUserId != null ">
|
||||
and shipper_user_id = #{shipperUserId}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="organizationId != null ">
|
||||
and organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO" resultMap="DriverFollowShipperResult">
|
||||
<include refid="selectDriverFollowShipperPo"/>
|
||||
<include refid="selectDriverFollowShipperPo1"/>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.DriverVehicleBindMapper">
|
||||
|
||||
|
||||
<sql id="selectDriverVehicleBindPo">
|
||||
select
|
||||
a.*
|
||||
from driver_vehicle_bind a
|
||||
where a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectDriverVehicleBindPo1">
|
||||
<if test="driverVehicleBind.userId !=null">
|
||||
and a.user_id = #{driverVehicleBind.userId}
|
||||
</if>
|
||||
<if test="driverVehicleBind.vehicleId !=null">
|
||||
and a.vehicle_id = #{driverVehicleBind.vehicleId}
|
||||
</if>
|
||||
<if test="driverVehicleBind.defaultFlag !=null">
|
||||
and a.default_flag = #{driverVehicleBind.defaultFlag}
|
||||
</if>
|
||||
<if test="driverVehicleBind.driverBindId !=null">
|
||||
and a.driver_bind_id = #{driverVehicleBind.driverBindId}
|
||||
</if>
|
||||
<if test="driverVehicleBind.driverBindId !=null">
|
||||
and a.driver_bind_id = #{driverVehicleBind.driverBindId}
|
||||
</if>
|
||||
<if test="driverVehicleBind.queryInfo !=null and driverVehicleBind.queryInfo !=''">
|
||||
and (a.bind_driver_name like concat('%' , #{driverVehicleBind.queryInfo } , '%') OR a.vehicle_license_plate_number like concat('%' , #{driverVehicleBind.queryInfo } , '%'))
|
||||
</if>
|
||||
<if test="driverVehicleBind.vehicleLicensePlateNumber !=null and driverVehicleBind.vehicleLicensePlateNumber != ''">
|
||||
and a.vehicle_license_plate_number like concat('%' , #{driverVehicleBind.vehicleLicensePlateNumber } , '%')
|
||||
</if>
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="queryList" resultType="com.mhd.user.domain.userAggregate.repository.po.DriverVehicleBindPo">
|
||||
<include refid="selectDriverVehicleBindPo"/>
|
||||
<include refid="selectDriverVehicleBindPo1"/>
|
||||
</select>
|
||||
|
||||
<select id="selectUserBindByVehicleId" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
SELECT
|
||||
DISTINCT u.user_id AS userId,
|
||||
u.user_name AS userName,
|
||||
u.user_phone AS userPhone
|
||||
FROM
|
||||
`driver_vehicle_bind` b
|
||||
LEFT JOIN
|
||||
`user` u
|
||||
ON b.user_id = u.user_id
|
||||
WHERE
|
||||
vehicle_id = #{values}
|
||||
</select>
|
||||
|
||||
<select id="queryVehicleBindInfo" resultType="com.mhd.user.interfaces.facadeApi.Po.VehicleDriverBindAppPo" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
u.user_id AS userId,
|
||||
u.user_name AS userName,
|
||||
u.avatar AS avatar,
|
||||
b.driver_bind_id AS driverBindId,
|
||||
b.default_flag,
|
||||
b.vehicle_id,
|
||||
b.vehicle_license_plate_number
|
||||
FROM
|
||||
`driver_vehicle_bind` b
|
||||
LEFT JOIN `user` u ON b.driver_bind_id = u.user_id
|
||||
WHERE
|
||||
b.del_flag = 1
|
||||
<include refid="where_two"></include>
|
||||
</select>
|
||||
|
||||
<sql id="where_two">
|
||||
<if test="driverVehicleBindDo.vehicleId !=null">
|
||||
AND b.vehicle_id = #{driverVehicleBindDo.vehicleId}
|
||||
</if>
|
||||
<if test="driverVehicleBindDo.driverBindId !=null">
|
||||
AND b.driver_bind_id = #{driverVehicleBindDo.driverBindId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.FeedbackMapper">
|
||||
|
||||
<sql id="selectFeedbackVo">
|
||||
SELECT feedback_id,
|
||||
comment_about_code,
|
||||
comment_about_name,
|
||||
comment,
|
||||
comment_url,
|
||||
organization_id,
|
||||
top_organization_id,
|
||||
create_time,
|
||||
create_by,
|
||||
create_by_name,
|
||||
update_time,
|
||||
update_by,
|
||||
update_by_name,
|
||||
del_flag
|
||||
FROM feedback
|
||||
</sql>
|
||||
|
||||
<!--通用的查询条件-->
|
||||
<sql id="common_where">
|
||||
<if test="null != feedbackId ">
|
||||
AND feedback_id = #{feedbackId}
|
||||
</if>
|
||||
<if test="null != commentAboutCode and '' != commentAboutCode">
|
||||
AND comment_about_code = #{commentAboutCode}
|
||||
</if>
|
||||
<if test="null != commentAboutName and '' != commentAboutName">
|
||||
AND comment_about_name = #{commentAboutName}
|
||||
</if>
|
||||
<if test="null != comment and '' != comment">
|
||||
AND comment = #{comment}
|
||||
</if>
|
||||
<if test="null != commentUrl and '' != commentUrl">
|
||||
AND comment_url = #{commentUrl}
|
||||
</if>
|
||||
<if test="null != organizationId ">
|
||||
AND organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="null != topOrganizationId ">
|
||||
AND top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="null != createBy ">
|
||||
AND create_by = #{createBy}
|
||||
</if>
|
||||
<if test="null != createByName and '' != createByName">
|
||||
AND create_by_name = #{createByName}
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="null != updateBy ">
|
||||
AND update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="null != updateByName and '' != updateByName">
|
||||
AND update_by_name = #{updateByName}
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
AND del_flag = #{delFlag}
|
||||
</if>
|
||||
ORDER BY create_time desc
|
||||
|
||||
</sql>
|
||||
<select id="feedbackList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.FeedbackDO"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.FeedbackPo">
|
||||
<include refid="selectFeedbackVo"></include>
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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.mhd.user.domain.motorcadeCollection.repository.mapper.MotorcadeCollectionMapper">
|
||||
|
||||
<resultMap type="com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO" id="MotorcadeCollectionResult">
|
||||
<result property="motorcadeCollectionId" column="motorcade_collection_id" />
|
||||
<result property="organizationId" column="organization_id" />
|
||||
<result property="organizationName" column="organization_name" />
|
||||
<result property="topOrganizationId" column="top_organization_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="motorcadeId" column="motorcade_id" />
|
||||
<result property="motorcadeName" column="motorcade_name" />
|
||||
<result property="motorcadeHeaderId" column="motorcade_header_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="agreementUrl" column="agreement_url" />
|
||||
<result property="contractNo" column="contract_no" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectMotorcadeCollectionPo">
|
||||
select * from motorcade_collection
|
||||
</sql>
|
||||
|
||||
<sql id="selectMotorcadeCollectionPo1">
|
||||
<where>
|
||||
<if test="organizationId != null ">
|
||||
and organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeId != null ">
|
||||
and motorcade_id = #{motorcadeId}
|
||||
</if>
|
||||
<if test="motorcadeName != null and motorcadeName != ''">
|
||||
and motorcade_name like concat('%', #{motorcadeName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeHeaderId != null ">
|
||||
and motorcade_header_id = #{motorcadeHeaderId}
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="agreementUrl != null and agreementUrl != ''">
|
||||
and agreement_url = #{agreementUrl}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO" resultMap="MotorcadeCollectionResult">
|
||||
<include refid="selectMotorcadeCollectionPo"/>
|
||||
<include refid="selectMotorcadeCollectionPo1"/>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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.mhd.user.domain.motorcade.repository.mapper.MotorcadeDriverMapper">
|
||||
<select id="selectMotorcadeIdByUserId" parameterType="java.lang.Long" resultType="java.lang.Long">
|
||||
SELECT
|
||||
d.motorcade_id
|
||||
FROM
|
||||
`motorcade` d
|
||||
WHERE
|
||||
d.del_flag = 1 AND
|
||||
d.motorcade_header_id = #{values}
|
||||
</select>
|
||||
|
||||
<select id="selectDriverIdByMotorcadeId" resultType="com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo">
|
||||
SELECT
|
||||
b.user_id,
|
||||
b.create_by
|
||||
FROM
|
||||
`motorcade_driver` a
|
||||
left join user_driver b on a.user_id = b.user_id
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.motorcade_id IN
|
||||
<foreach item="id" collection="motorcadeIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
group by b.user_id
|
||||
</select>
|
||||
|
||||
<insert id="batchAddMotorcadeDriver" parameterType="java.util.List">
|
||||
insert into motorcade_driver
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
motorcade_id,
|
||||
driver_id,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{item.motorcadeId},
|
||||
#{item.driverId},
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,383 @@
|
||||
<?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.mhd.user.domain.motorcade.repository.mapper.MotorcadeMapper">
|
||||
|
||||
<resultMap type="com.mhd.user.domain.motorcade.repository.po.MotorcadePo" id="MotorcadeResult">
|
||||
<result property="motorcadeId" column="motorcade_id" />
|
||||
<result property="organizationName" column="organization_name" />
|
||||
<result property="motorcadeName" column="motorcade_name" />
|
||||
<result property="motorcadeImage" column="motorcade_image" />
|
||||
<result property="motorcadeDescribtion" column="motorcade_describtion" />
|
||||
<result property="motorcadeStatus" column="motorcade_status" />
|
||||
<result property="motorcadeHeaderId" column="motorcade_header_id" />
|
||||
<result property="motorcadeHeaderName" column="motorcade_header_name" />
|
||||
<result property="motorcadeHeaderAccount" column="motorcade_header_account" />
|
||||
<result property="motorcadeScore" column="motorcade_score" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="checkPersonId" column="check_person_id" />
|
||||
<result property="checkPersonName" column="check_person_name" />
|
||||
<result property="checkPersonTime" column="check_person_time" />
|
||||
<result property="motorcadeDissolutionStatus" column="motorcade_dissolution_status" />
|
||||
<result property="blackListReason" column="black_list_reason" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectMotorcadePo">
|
||||
SELECT
|
||||
motorcade_id,
|
||||
organization_name,
|
||||
motorcade_name,
|
||||
motorcade_image,
|
||||
motorcade_describtion,
|
||||
motorcade_status,
|
||||
motorcade_header_id,
|
||||
motorcade_header_name,
|
||||
motorcade_header_account,
|
||||
motorcade_score,
|
||||
create_time,
|
||||
create_by,
|
||||
create_by_name,
|
||||
update_time,
|
||||
update_by,
|
||||
update_by_name,
|
||||
del_flag,
|
||||
check_person_id,
|
||||
check_person_name,
|
||||
check_person_time,
|
||||
motorcade_dissolution_status
|
||||
FROM
|
||||
motorcade
|
||||
</sql>
|
||||
|
||||
<sql id="selectMotorcadePo1">
|
||||
<where>
|
||||
del_flag = 1
|
||||
<if test="motorcadeId != null and motorcadeId != ''">
|
||||
and motorcade_id = #{motorcadeId}
|
||||
</if>
|
||||
<if test="motorcadeName != null and motorcadeName != ''">
|
||||
and motorcade_name like concat('%', #{motorcadeName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeImage != null and motorcadeImage != ''">
|
||||
and motorcade_image = #{motorcadeImage}
|
||||
</if>
|
||||
<if test="motorcadeDescribtion != null and motorcadeDescribtion != ''">
|
||||
and motorcade_describtion = #{motorcadeDescribtion}
|
||||
</if>
|
||||
<if test="motorcadeStatus != null ">
|
||||
and motorcade_status = #{motorcadeStatus}
|
||||
</if>
|
||||
<if test="motorcadeHeaderId != null ">
|
||||
and motorcade_header_id = #{motorcadeHeaderId}
|
||||
</if>
|
||||
<if test="motorcadeHeaderName != null and motorcadeHeaderName != ''">
|
||||
and motorcade_header_name like concat('%', #{motorcadeHeaderName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeHeaderAccount != null and motorcadeHeaderAccount != ''">
|
||||
and motorcade_header_account like concat('%', #{motorcadeHeaderAccount}, '%')
|
||||
</if>
|
||||
<if test="motorcadeScore != null ">
|
||||
and motorcade_score = #{motorcadeScore}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeDissolutionStatus != null ">
|
||||
and motorcade_dissolution_status = #{motorcadeDissolutionStatus}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="organizationIdList != null ">
|
||||
AND organization_id in
|
||||
<foreach item="id" collection="organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO" resultMap="MotorcadeResult">
|
||||
SELECT
|
||||
m.motorcade_id,
|
||||
m.organization_id,
|
||||
m.organization_name,
|
||||
m.top_organization_id,
|
||||
COUNT(d.user_id) AS driver_num,
|
||||
SUM(u.vehicle_num) AS vehicle_num,
|
||||
m.motorcade_name,
|
||||
m.motorcade_image,
|
||||
m.motorcade_describtion,
|
||||
m.motorcade_status,
|
||||
m.motorcade_header_id,
|
||||
m.motorcade_reject_reason,
|
||||
m.black_list_reason,
|
||||
m.motorcade_header_name,
|
||||
m.motorcade_header_account,
|
||||
m.motorcade_score,
|
||||
m.create_time,
|
||||
m.create_by,
|
||||
m.create_by_name,
|
||||
m.update_time,
|
||||
m.update_by,
|
||||
m.update_by_name,
|
||||
m.del_flag,
|
||||
m.check_person_id,
|
||||
m.check_person_name,
|
||||
m.check_person_time,
|
||||
m.motorcade_dissolution_status,
|
||||
m.default_flag
|
||||
FROM
|
||||
motorcade m
|
||||
LEFT JOIN
|
||||
motorcade_driver d
|
||||
ON m.motorcade_id = d.motorcade_id and d.del_flag = 1
|
||||
LEFT JOIN
|
||||
(SELECT
|
||||
u.user_id,
|
||||
COUNT(b.vehicle_id) AS vehicle_num
|
||||
FROM
|
||||
`user_driver` u
|
||||
LEFT JOIN
|
||||
driver_vehicle_bind b
|
||||
ON u.user_id = b.driver_bind_id and b.del_flag = 1
|
||||
WHERE
|
||||
u.del_flag = 1
|
||||
GROUP BY
|
||||
u.user_id) u
|
||||
ON u.user_id = d.user_id
|
||||
<where>
|
||||
m.del_flag = 1
|
||||
<if test="checkPersonName != null and checkPersonName != ''">
|
||||
and m.check_person_name like concat('%', #{checkPersonName}, '%')
|
||||
</if>
|
||||
/*添加时间*/
|
||||
<if test="createTimeFrom!=null and createTimeTo!=null ">
|
||||
and DATE_FORMAT(m.create_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{createTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(m.create_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{createTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/*审核时间*/
|
||||
<if test="userAuthTimeFrom!=null and userAuthTimeTo!=null ">
|
||||
and DATE_FORMAT(m.check_person_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{userAuthTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(m.check_person_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{userAuthTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
<if test="motorcadeName != null and motorcadeName != ''">
|
||||
and m.motorcade_name like concat('%', #{motorcadeName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeImage != null and motorcadeImage != ''">
|
||||
and m.motorcade_image = #{motorcadeImage}
|
||||
</if>
|
||||
<if test="motorcadeDescribtion != null and motorcadeDescribtion != ''">
|
||||
and m.motorcade_describtion = #{motorcadeDescribtion}
|
||||
</if>
|
||||
<if test="motorcadeStatus != null ">
|
||||
and m.motorcade_status = #{motorcadeStatus}
|
||||
</if>
|
||||
<if test="motorcadeHeaderId != null ">
|
||||
and m.motorcade_header_id = #{motorcadeHeaderId}
|
||||
</if>
|
||||
<if test="motorcadeHeaderName != null and motorcadeHeaderName != ''">
|
||||
and m.motorcade_header_name like concat('%', #{motorcadeHeaderName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeHeaderAccount != null and motorcadeHeaderAccount != ''">
|
||||
and m.motorcade_header_account like concat('%', #{motorcadeHeaderAccount}, '%')
|
||||
</if>
|
||||
<if test="motorcadeScore != null ">
|
||||
and m.motorcade_score = #{motorcadeScore}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and m.create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and m.update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeDissolutionStatus != null ">
|
||||
and m.motorcade_dissolution_status = #{motorcadeDissolutionStatus}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and m.organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null and topOrganizationId != ''">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="organizationIdList != null ">
|
||||
AND m.organization_id in
|
||||
<foreach item="id" collection="organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
m.motorcade_id
|
||||
order by m.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectMotorcadeIdList" parameterType="java.lang.Long" resultType="java.lang.Long">
|
||||
SELECT
|
||||
m.motorcade_id
|
||||
FROM
|
||||
motorcade m
|
||||
LEFT JOIN
|
||||
motorcade_driver d
|
||||
ON m.motorcade_id = d.motorcade_id AND d.del_flag = 1
|
||||
WHERE
|
||||
m.del_flag = 1
|
||||
AND d.user_id = #{values}
|
||||
</select>
|
||||
|
||||
<select id="selectMotorcadeDriverByDriverId" resultType="com.mhd.user.domain.motorcade.entity.MotorcadeDriver" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
b.*
|
||||
FROM
|
||||
motorcade a
|
||||
LEFT JOIN motorcade_driver b ON a.motorcade_id = b.motorcade_id
|
||||
AND b.del_flag = 1
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
AND a.motorcade_header_id = #{driverId}
|
||||
</select>
|
||||
|
||||
<select id="queryMyMotorcadeList" resultType="com.mhd.user.domain.motorcade.repository.po.MotorcadeAppPo" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO">
|
||||
SELECT
|
||||
m.*,
|
||||
COUNT( d.user_id ) AS driver_num,
|
||||
SUM( dvb.vehicle_num ) AS vehicle_num,
|
||||
GROUP_CONCAT(d.user_id) AS userIds,
|
||||
u.user_phone
|
||||
FROM
|
||||
motorcade m
|
||||
LEFT JOIN motorcade_driver d ON m.motorcade_id = d.motorcade_id AND d.del_flag = 1
|
||||
LEFT JOIN `user` u ON u.user_id = m.motorcade_header_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
u.user_id,
|
||||
COUNT( u.user_id ) AS vehicle_num
|
||||
FROM
|
||||
driver_vehicle_bind u
|
||||
WHERE
|
||||
u.del_flag = 1
|
||||
GROUP BY
|
||||
u.user_id
|
||||
) dvb ON dvb.user_id = d.user_id AND d.del_flag = 1
|
||||
WHERE
|
||||
m.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
GROUP BY
|
||||
m.motorcade_id
|
||||
ORDER BY
|
||||
m.create_time DESC
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="motorcadeDo.motorcadeId !=null">
|
||||
AND m.motorcade_id = #{motorcadeDo.motorcadeId}
|
||||
</if>
|
||||
<if test="motorcadeDo.myMotorcadeUserId !=null">
|
||||
AND (m.motorcade_header_id = #{motorcadeDo.myMotorcadeUserId} or d.user_id = #{motorcadeDo.myMotorcadeUserId})
|
||||
</if>
|
||||
<if test="motorcadeDo.motorcadeHeaderId !=null">
|
||||
AND m.motorcade_header_id = #{motorcadeDo.motorcadeHeaderId}
|
||||
</if>
|
||||
<if test="motorcadeDo.userId !=null">
|
||||
AND d.user_id = #{motorcadeDo.userId}
|
||||
</if>
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="getDriverListById" resultType="com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO">
|
||||
select md.motorcade_driver_id,
|
||||
u.user_name,
|
||||
u.user_id,
|
||||
u.user_account,
|
||||
group_concat( DISTINCT dvb.vehicle_license_plate_number) as vehiclePlateNumbers,
|
||||
count(dvb.vehicle_license_plate_number) as vehicleNum,
|
||||
ud.driver_fill,
|
||||
md.create_time,
|
||||
mc.agreement_url,
|
||||
u.create_by,
|
||||
m.motorcade_header_id,
|
||||
mc.contract_status,
|
||||
mc.file_id,
|
||||
mc.agreement_url_pdf
|
||||
from motorcade_driver md
|
||||
left join user u on md.user_id = u.user_id and u.del_flag = 1
|
||||
left join user_driver ud on ud.user_id = md.user_id and ud.del_flag = 1
|
||||
left join driver_vehicle_bind dvb
|
||||
on md.user_id = dvb.driver_bind_id and dvb.del_flag = 1
|
||||
left join motorcade m on m.motorcade_id = md.motorcade_id
|
||||
LEFT JOIN motorcade_collection mc ON mc.user_id = md.user_id and mc.motorcade_header_id = m.motorcade_header_id
|
||||
|
||||
where md.del_flag = 1 and md.motorcade_id = #{motorcadeDo.motorcadeId}
|
||||
group by motorcade_driver_id
|
||||
</select>
|
||||
|
||||
<select id="fleetInviteDriverList" resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverPo" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeDriverDO">
|
||||
select
|
||||
u.user_account,
|
||||
u.user_phone,
|
||||
u.user_name,
|
||||
dvb.vehicle_license_plate_number,
|
||||
ud.*,
|
||||
r.roleCode
|
||||
from user_driver ud
|
||||
left join user u on ud.user_id = u.user_id
|
||||
LEFT JOIN (SELECT
|
||||
user_id,
|
||||
GROUP_CONCAT( DISTINCT r.role_code SEPARATOR '&' ) roleCode
|
||||
FROM
|
||||
role r
|
||||
LEFT JOIN user_role ur ON r.role_id = ur.role_id
|
||||
AND ur.del_flag = 1
|
||||
WHERE
|
||||
r.del_flag = 1
|
||||
AND role_code IN ( 'driver', 'carrier', 'captain' )
|
||||
GROUP BY
|
||||
user_id
|
||||
) r ON r.user_id = u.user_id
|
||||
left join motorcade_driver md on md.user_id = ud.user_id and md.del_flag = 1
|
||||
left join driver_vehicle_bind dvb on u.user_id = dvb.user_id and dvb.del_flag = 1 and dvb.default_flag = 1
|
||||
<where>ud.del_flag = 1
|
||||
and u.del_flag = 1
|
||||
and ud.driver_fill = 3
|
||||
and u.top_organization_id = #{motorcadeDriverDO.topOrganizationId}
|
||||
and r.roleCode not like '%carrier%' and r.roleCode not like '%captain%'
|
||||
<if test="motorcadeDriverDO.motorcadeId !=null">
|
||||
and (md.motorcade_id != #{motorcadeDriverDO.motorcadeId} or md.motorcade_id is null)
|
||||
</if>
|
||||
<if test="motorcadeDriverDO.userPhone !=null and motorcadeDriverDO.userPhone != ''">
|
||||
and u.user_phone = #{motorcadeDriverDO.userPhone}
|
||||
</if>
|
||||
<if test="motorcadeDriverDO.userName !=null and motorcadeDriverDO.userName != ''">
|
||||
and u.user_name like concat('%', #{motorcadeDriverDO.userName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeDriverDO.vehicleLicensePlateNumber !=null and motorcadeDriverDO.vehicleLicensePlateNumber != ''">
|
||||
and dvb.vehicle_license_plate_number like concat('%', #{motorcadeDriverDO.vehicleLicensePlateNumber}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by u.user_id
|
||||
</select>
|
||||
<select id="queryNonePagingList" resultType="com.mhd.user.domain.motorcade.repository.po.MotorcadePo">
|
||||
SELECT
|
||||
m.motorcade_id,
|
||||
m.motorcade_name
|
||||
FROM
|
||||
motorcade m
|
||||
LEFT JOIN
|
||||
motorcade_driver d
|
||||
ON m.motorcade_id = d.motorcade_id and d.del_flag = 1
|
||||
where top_organization_id = #{organizationId} and m.del_flag = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,146 @@
|
||||
<?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.mhd.user.domain.motorcade.repository.mapper.MotorcadeRecordMapper">
|
||||
|
||||
<resultMap type="com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo" id="MotorcadeRecordResult">
|
||||
<result property="motorcadeRecordId" column="motorcade_record_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="motorcadeId" column="motorcade_id" />
|
||||
<result property="motorcadeName" column="motorcade_name" />
|
||||
<result property="motorcadeImage" column="motorcade_image" />
|
||||
<result property="motorcadeDescribtion" column="motorcade_describtion" />
|
||||
<result property="motorcadeHeaderName" column="motorcade_header_name" />
|
||||
<result property="motorcadeScore" column="motorcade_score" />
|
||||
<result property="motorcadeRecordStatus" column="motorcade_record_status" />
|
||||
<result property="recordTime" column="record_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectMotorcadeRecordPo">
|
||||
SELECT * FROM motorcade_record
|
||||
</sql>
|
||||
|
||||
<sql id="selectMotorcadeRecordPo1">
|
||||
<where>
|
||||
del_flag = 1
|
||||
<if test="motorcadeRecordDo.userId != null ">
|
||||
and user_id = #{motorcadeRecordDo.userId}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeId != null ">
|
||||
and motorcade_id = #{motorcadeRecordDo.motorcadeId}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeName != null and motorcadeRecordDo.motorcadeName != ''">
|
||||
and motorcade_name like concat('%', #{motorcadeRecordDo.motorcadeName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeImage != null and motorcadeRecordDo.motorcadeImage != ''">
|
||||
and motorcade_image = #{motorcadeRecordDo.motorcadeImage}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeDescribtion != null and motorcadeRecordDo.motorcadeDescribtion != ''">
|
||||
and motorcade_describtion = #{motorcadeRecordDo.motorcadeDescribtion}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeHeaderName != null and motorcadeRecordDo.motorcadeHeaderName != ''">
|
||||
and motorcade_header_name like concat('%', #{motorcadeRecordDo.motorcadeHeaderName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeScore != null ">
|
||||
and motorcade_score = #{motorcadeRecordDo.motorcadeScore}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.motorcadeRecordStatus != null ">
|
||||
and motorcade_record_status = #{motorcadeRecordDo.motorcadeRecordStatus}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.createStartTime != null ">
|
||||
AND DATE_FORMAT(create_time,'%Y-%m-%d') >= #{motorcadeRecordDo.createStartTime}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.createEndTime != null ">
|
||||
AND DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[<=]]> #{motorcadeRecordDo.createEndTime}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.createByName != null and motorcadeRecordDo.createByName != ''">
|
||||
and create_by_name like concat('%', #{motorcadeRecordDo.createByName}, '%')
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.updateByName != null and motorcadeRecordDo.updateByName != ''">
|
||||
and update_by_name like concat('%', #{motorcadeRecordDo.updateByName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO" resultMap="MotorcadeRecordResult">
|
||||
<include refid="selectMotorcadeRecordPo"/>
|
||||
<include refid="selectMotorcadeRecordPo1"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
<select id="selectRecordList" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO" resultMap="MotorcadeRecordResult">
|
||||
<include refid="selectMotorcadeRecordPo"/>
|
||||
<where>
|
||||
del_flag = 1
|
||||
<if test="isNew != null and isNew != '0'.toString()">
|
||||
and motorcade_record_status != 0
|
||||
</if>
|
||||
<if test="isNew != null and isNew == '0'.toString()">
|
||||
and motorcade_record_status = 0
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="invitationRecordList" resultType="com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverAppPo" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO">
|
||||
SELECT
|
||||
mr.user_id,
|
||||
u.user_name,
|
||||
u.user_phone,
|
||||
u.avatar,
|
||||
dvb.vehicle_license_plate_number,
|
||||
dvb.vehicle_type_name,
|
||||
mr.create_time,
|
||||
mr.motorcade_record_status
|
||||
FROM
|
||||
motorcade_record mr
|
||||
LEFT JOIN user_driver ud ON mr.user_id = ud.user_id
|
||||
AND ud.del_flag = 1
|
||||
LEFT JOIN `user` u ON ud.user_id = u.user_id
|
||||
LEFT JOIN driver_vehicle_bind dvb ON dvb.user_id = mr.user_id
|
||||
AND dvb.del_flag = 1
|
||||
WHERE
|
||||
mr.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
ORDER BY
|
||||
create_time DESC
|
||||
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="motorcadeRecordDo.motorcadeId != null">
|
||||
AND mr.motorcade_id = #{motorcadeRecordDo.motorcadeId}
|
||||
</if>
|
||||
<if test="motorcadeRecordDo.userId != null">
|
||||
AND mr.user_id = #{motorcadeRecordDo.userId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="invitationRecordListPC" resultType="com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo" parameterType="com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO">
|
||||
SELECT mr.user_id,
|
||||
u.user_name,
|
||||
u.user_phone,
|
||||
u.avatar,
|
||||
dvb.vehicle_id,
|
||||
dvb.vehicle_license_plate_number,
|
||||
dvb.vehicle_type_name,
|
||||
mr.create_time,
|
||||
mr.motorcade_record_status,
|
||||
mr.motorcade_id,
|
||||
mr.motorcade_name
|
||||
FROM motorcade_record mr
|
||||
LEFT JOIN `user` u ON mr.user_id = u.user_id
|
||||
LEFT JOIN driver_vehicle_bind dvb ON dvb.driver_bind_id = mr.user_id AND dvb.default_flag = 1
|
||||
AND dvb.del_flag = 1
|
||||
WHERE mr.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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.mhd.user.domain.projectUser.repository.mapper.ProjectUserMapper">
|
||||
|
||||
<resultMap type="com.mhd.common.core.domain.po.projectManagement.ProjectUserPO" id="ProjectUserResult">
|
||||
<result property="projectUserId" column="project_user_id" />
|
||||
<result property="projectManagementId" column="project_management_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectProjectUserPo">
|
||||
select project_user_id, project_management_id, user_id, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from project_user
|
||||
</sql>
|
||||
|
||||
<sql id="selectProjectUserPo1">
|
||||
<where>
|
||||
<if test="projectManagementId != null ">
|
||||
and project_management_id = #{projectManagementId}
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.projectUser.repository.todo.ProjectUserDO" resultMap="ProjectUserResult">
|
||||
<include refid="selectProjectUserPo"/>
|
||||
<include refid="selectProjectUserPo1"/>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?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.mhd.user.domain.roleAggregate.repository.mapper.RoleMapper">
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
SELECT a.role_id,
|
||||
a.parent_role_id,
|
||||
a.role_business_example_id,
|
||||
a.role_business_example_name,
|
||||
a.role_type,
|
||||
a.role_code,
|
||||
a.role_name,
|
||||
a.role_remark,
|
||||
a.role_data_scope,
|
||||
a.role_status
|
||||
FROM `role` a
|
||||
WHERE a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleDo"
|
||||
resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
SELECT
|
||||
a.role_id,
|
||||
a.parent_role_id,
|
||||
a.organization_id,
|
||||
a.role_code,
|
||||
a.role_name,
|
||||
a.role_remark,
|
||||
a.role_data_scope,
|
||||
a.role_status,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.update_by_name,
|
||||
a.del_flag,
|
||||
a.role_business_example_id,
|
||||
a.role_business_example_name,
|
||||
a.role_type,
|
||||
a.role_type_name,
|
||||
a.role_grade,
|
||||
COUNT(DISTINCT u.user_id) roleUserCount
|
||||
FROM
|
||||
`role` a
|
||||
LEFT JOIN user_role b on a.role_id = b.role_id
|
||||
left join user u on b.user_id = u.user_id and u.del_flag = 1
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
GROUP BY a.role_id
|
||||
</select>
|
||||
<select id="selectByOrganizationIdAndRoleCode"
|
||||
parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleDo"
|
||||
resultType="com.mhd.user.domain.roleAggregate.entity.RoleEntity">
|
||||
SELECT
|
||||
a.role_id,
|
||||
a.parent_role_id,
|
||||
a.role_business_example_id,
|
||||
a.role_business_example_name,
|
||||
a.role_type,
|
||||
a.role_code,
|
||||
a.role_name,
|
||||
a.role_remark,
|
||||
a.role_data_scope,
|
||||
a.role_status
|
||||
FROM
|
||||
`role` a
|
||||
WHERE
|
||||
a.del_flag=1
|
||||
<include refid="common_where"></include>
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findDelByRoleId" parameterType="com.mhd.common.core.domain.po.RolePO"
|
||||
resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
SELECT a.role_id,
|
||||
a.parent_role_id,
|
||||
a.role_business_example_id,
|
||||
a.role_business_example_name,
|
||||
a.role_type,
|
||||
a.role_code,
|
||||
a.role_name,
|
||||
a.role_remark,
|
||||
a.role_data_scope,
|
||||
a.role_status
|
||||
FROM `role` a
|
||||
WHERE a.role_id = #{value}
|
||||
</select>
|
||||
<select id="selectByRoleId" parameterType="com.mhd.common.core.domain.po.RolePO"
|
||||
resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
<include refid="selectRoleVo"/>
|
||||
and a.role_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="selectByRoleCodeAndOrganizationId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleDo"
|
||||
resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
<include refid="selectRoleVo"/>
|
||||
and a.role_code = #{roleCode}
|
||||
and a.organization_id = #{organizationId}
|
||||
</select>
|
||||
|
||||
<select id="selectRoleByOrganizationAndCode"
|
||||
parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleDo"
|
||||
resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
<include refid="selectRoleVo"/>
|
||||
<include refid="common_where"></include>
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and a.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="roleGrade !=null and roleGrade !='' ">
|
||||
and a.role_grade = #{roleGrade}
|
||||
</if>
|
||||
<if test="organizationId !=null">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationIds !=null">
|
||||
and a.organization_id in
|
||||
<foreach item="organizationId" collection="organizationIds" open="(" separator="," close=")">
|
||||
#{organizationId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="roleCodeList !=null">
|
||||
and a.role_code in
|
||||
<foreach item="roleCode" collection="roleCodeList" open="(" separator="," close=")">
|
||||
#{roleCode}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="roleCode !=null and roleCode !='' ">
|
||||
and a.role_code = #{roleCode}
|
||||
</if>
|
||||
<if test="roleTypeName !=null and roleTypeName !='' ">
|
||||
and a.role_name like concat('%' , #{roleTypeName} , '%')
|
||||
</if>
|
||||
<if test="roleBusinessExampleName !=null and roleBusinessExampleName !='' ">
|
||||
and a.role_business_example_name like concat('%' , #{roleBusinessExampleName} , '%')
|
||||
</if>
|
||||
/*职务/角色状态:0-无状态,1-开启,2-关闭*/
|
||||
<if test="roleStatus !=null and roleStatus !='' ">
|
||||
and a.role_status = #{roleStatus}
|
||||
</if>
|
||||
/*角色分类:0-无状态,1-托运人,2-承运人,3-公共*/
|
||||
<if test="roleType !=null and roleType !='' ">
|
||||
and a.role_type = #{roleType}
|
||||
</if>
|
||||
/*角色分类:0-无状态,1-托运人,2-承运人,3-公共*/
|
||||
<if test="createBy !=null">
|
||||
and a.create_by = #{createBy}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 根据组织ID物理删除角色 -->
|
||||
<select id="deleteByOrganizationId" parameterType="java.lang.Long">
|
||||
DELETE
|
||||
FROM `role` a
|
||||
WHERE a.del_flag = 1
|
||||
and a.organization_id = #{value}
|
||||
</select>
|
||||
|
||||
<!-- 根据IDs合集查询角色名称 -->
|
||||
<select id="findRoleNameByRoleIds" parameterType="java.lang.Long" resultType="java.lang.String">
|
||||
SELECT
|
||||
GROUP_CONCAT( a.role_name SEPARATOR ';' ) AS roleName
|
||||
FROM
|
||||
`role` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
AND a.role_id IN
|
||||
<foreach collection="list" item="roleIds" index="index" open="(" separator=" , " close=")">
|
||||
#{roleIds}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectByRoleCode" resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
select * from role
|
||||
where del_flag = 1
|
||||
and role_code = #{roleCode}
|
||||
and organization_id = #{organizationId}
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and role_id != #{roleId}
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getRoleListByUserId" resultType="com.mhd.common.core.domain.po.RolePO">
|
||||
select distinct r.*
|
||||
from role r
|
||||
left join user_role ur on ur.role_id = r.role_id and ur.del_flag = 1
|
||||
<where>
|
||||
r.role_status = 1
|
||||
and r.del_flag = 1
|
||||
and ur.user_id = #{userId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?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.mhd.user.domain.roleAggregate.repository.mapper.RoleMenuMapper">
|
||||
|
||||
<sql id="selectRoleMenuVo">
|
||||
SELECT
|
||||
a.role_menu_id,
|
||||
a.role_id,
|
||||
a.menu_id
|
||||
FROM
|
||||
`role_menu` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo"
|
||||
resultType="com.mhd.user.domain.roleAggregate.entity.RoleMenuEntity">
|
||||
<include refid="selectRoleMenuVo"/>
|
||||
|
||||
</select>
|
||||
<select id="selectRoleMenuList" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo"
|
||||
resultType="com.mhd.common.core.domain.po.UserRoleMenuPO">
|
||||
SELECT DISTINCT
|
||||
a.menu_id,
|
||||
a.role_id
|
||||
FROM
|
||||
role_menu a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
<select id="selectByRoleMenuId" parameterType="com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo"
|
||||
resultType="com.mhd.user.domain.roleAggregate.entity.RoleMenuEntity">
|
||||
<include refid="selectRoleMenuVo"/>
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="roleMenuId !=null and roleMenuId !='' ">
|
||||
and a.role_menu_id = #{roleMenuId}
|
||||
</if>
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and a.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="roleIds!=null and roleIds.size() > 0">
|
||||
and a.role_id in <foreach item="roleId" index="index" collection="roleIds" open="(" separator=" , " close=")">#{roleId}</foreach>
|
||||
</if>
|
||||
<choose>
|
||||
<when test="roleMenuClient !=null">
|
||||
and a.role_menu_client = #{roleMenuClient}
|
||||
</when>
|
||||
<otherwise>
|
||||
and a.role_menu_client = 1
|
||||
</otherwise>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
<select id="removeByRoleId" parameterType="java.lang.Long">
|
||||
DELETE
|
||||
FROM
|
||||
`role_menu` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.role_id = #{roleId}
|
||||
<include refid="common_where_two"></include>
|
||||
</select>
|
||||
|
||||
<sql id="common_where_two">
|
||||
<if test="organizationId !=null">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="roleMenuClient !=null">
|
||||
and a.role_menu_client = #{roleMenuClient}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,89 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserAddressMapper">
|
||||
|
||||
<resultMap type="com.mhd.user.domain.userAggregate.entity.UserAddress" id="UserAddressResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="areaName" column="area_name"/>
|
||||
<result property="areaCode" column="area_code"/>
|
||||
<result property="detailedAddress" column="detailed_address"/>
|
||||
<result property="contactPerson" column="contact_person"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
<result property="isDefault" column="is_default"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.mhd.user.domain.userAggregate.repository.po.UserAddressPO" id="UserAddressPOResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="areaName" column="area_name"/>
|
||||
<result property="areaCode" column="area_code"/>
|
||||
<result property="detailedAddress" column="detailed_address"/>
|
||||
<result property="contactPerson" column="contact_person"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
<result property="isDefault" column="is_default"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserAddressVo">
|
||||
select id, user_id, area_name, area_code, detailed_address, contact_person, contact_phone, is_default,
|
||||
create_by, create_time, update_by, update_time, del_flag
|
||||
from user_address
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserAddressDO" resultMap="UserAddressPOResult">
|
||||
<include refid="selectUserAddressVo"/>
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
and area_name like concat('%', #{areaName}, '%')
|
||||
</if>
|
||||
<if test="contactPerson != null and contactPerson != ''">
|
||||
and contact_person like concat('%', #{contactPerson}, '%')
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">
|
||||
and contact_phone like concat('%', #{contactPhone}, '%')
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
and is_default = #{isDefault}
|
||||
</if>
|
||||
</where>
|
||||
order by is_default desc, create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getAddressByUserId" parameterType="Long" resultMap="UserAddressPOResult">
|
||||
<include refid="selectUserAddressVo"/>
|
||||
where del_flag = 0 and user_id = #{userId}
|
||||
order by is_default desc, create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getDefaultAddressByUserId" parameterType="Long" resultMap="UserAddressPOResult">
|
||||
<include refid="selectUserAddressVo"/>
|
||||
where del_flag = 0 and user_id = #{userId} and is_default = 1
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="clearDefaultAddressByUserId" parameterType="Long">
|
||||
update user_address set is_default = 0
|
||||
where del_flag = 0 and user_id = #{userId} and is_default = 1
|
||||
</update>
|
||||
|
||||
<update id="setDefaultAddress" parameterType="Long">
|
||||
update user_address set is_default = 1
|
||||
where del_flag = 0 and id = #{addressId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserDataPermissionMapper">
|
||||
|
||||
<sql id="selectUserDataPermissionVo">
|
||||
SELECT
|
||||
a.user_data_permission_id,
|
||||
a.user_id,
|
||||
a.menu_id,
|
||||
a.product_id,
|
||||
a.organization_id,
|
||||
a.user_data_personal_status,
|
||||
a.user_data_organization_status
|
||||
FROM
|
||||
`user_data_permission` a
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDataPermissionDO"
|
||||
resultType="com.mhd.common.core.domain.po.UserDataPermissionPO">
|
||||
<include refid="selectUserDataPermissionVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
|
||||
<select id="findUserDataPermission" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDataPermissionDO"
|
||||
resultType="com.mhd.common.core.domain.po.UserDataPermissionPO">
|
||||
<include refid="selectUserDataPermissionVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
</if>
|
||||
<if test="menuId !=null and menuId !='' ">
|
||||
and a.menu_id = #{menuId}
|
||||
</if>
|
||||
<if test="productId !=null and productId !='' ">
|
||||
and a.product_id = #{productId}
|
||||
</if>
|
||||
<if test="organizationId !=null and organizationId !='' ">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="deleteByUserId" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDataPermissionDO" >
|
||||
DELETE
|
||||
FROM
|
||||
`user_data_permission` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.user_id = #{userId}
|
||||
and a.menu_id = #{menuId}
|
||||
and a.product_id = #{productId}
|
||||
and a.organization_id = #{organizationId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserDriverEnterpriseMapper">
|
||||
|
||||
<sql id="selectUserDriverEnterprisePo">
|
||||
select
|
||||
a.*
|
||||
from user_driver_enterprise a
|
||||
LEFT JOIN `user` b ON a.user_id = b.user_id AND b.del_flag = 1
|
||||
where
|
||||
a.del_flag = 1 and a.driver_type = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectCaptainPo">
|
||||
select
|
||||
a.*
|
||||
from user_driver_enterprise a
|
||||
LEFT JOIN `user` b ON a.user_id = b.user_id AND b.del_flag = 1
|
||||
where
|
||||
a.del_flag = 1 and a.driver_type = 2
|
||||
</sql>
|
||||
|
||||
<sql id="selectUserDriverEnterprisePo1">
|
||||
<if test="userDriverEnterpriseDo.createBy != null"> and b.create_by = #{userDriverEnterpriseDo.createBy}</if>
|
||||
<if test="userDriverEnterpriseDo.userId != null">
|
||||
and a.user_id = #{userDriverEnterpriseDo.userId}</if>
|
||||
<if test="userDriverEnterpriseDo.createBy != null and userDriverEnterpriseDo.organizationIdList == null">
|
||||
and b.create_by = #{userDriverEnterpriseDo.createBy}</if>
|
||||
<if test="userDriverEnterpriseDo.organizationIdList != null and userDriverEnterpriseDo.createBy == null">
|
||||
AND b.organization_id in
|
||||
<foreach item="id" collection="userDriverEnterpriseDo.organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userDriverEnterpriseDo.organizationIdList != null and userDriverEnterpriseDo.createBy != null">
|
||||
AND (b.organization_id in
|
||||
<foreach item="id" collection="userDriverEnterpriseDo.organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
OR b.create_by = #{userDriverEnterpriseDo.createBy})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDriverEnterpriseDo"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo">
|
||||
<include refid="selectUserDriverEnterprisePo"/>
|
||||
<include refid="selectUserDriverEnterprisePo1"/>
|
||||
</select>
|
||||
<select id="selectUserIdListByUserId" resultType="java.lang.Long">
|
||||
SELECT
|
||||
a.user_id
|
||||
FROM
|
||||
user_driver a
|
||||
LEFT JOIN motorcade b ON a.user_id = b.motorcade_header_id
|
||||
LEFT JOIN motorcade_driver c on b.motorcade_id=c.motorcade_id
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
AND a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserDriverEnterpriseByUserId" resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
user_driver_enterprise a
|
||||
WHERE
|
||||
a.del_flag = 1 and a.driver_type = 1
|
||||
AND a.user_id = #{userId}
|
||||
</select>
|
||||
<select id="selectUserDriverEnterpriseByUserId1" resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
user_driver_enterprise a
|
||||
WHERE
|
||||
a.del_flag = 1 and a.driver_type = 2
|
||||
AND a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="getCaptainInfoByUserId" resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
user_driver_enterprise a
|
||||
WHERE
|
||||
a.del_flag = 1 and a.driver_type = 2
|
||||
AND a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="queryCaptainList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDriverEnterpriseDo"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo">
|
||||
<include refid="selectCaptainPo"/>
|
||||
<include refid="selectUserDriverEnterprisePo1"/>
|
||||
</select>
|
||||
|
||||
<select id="getEnterpriseByUserId" resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
user_driver_enterprise a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
AND a.driver_type = 1
|
||||
AND a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,750 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserMapper">
|
||||
|
||||
<sql id="selectUserVo">
|
||||
SELECT a.user_id,
|
||||
a.top_organization_id,
|
||||
a.organization_id,
|
||||
a.organization_name,
|
||||
a.role_id,
|
||||
a.role_name,
|
||||
a.user_phone,
|
||||
a.role_code,
|
||||
a.user_phone,
|
||||
a.user_name,
|
||||
a.user_account,
|
||||
a.last_login_time,
|
||||
COALESCE(CONCAT( a.user_name, ' ', a.user_phone, ' ', a.user_account)
|
||||
,a.user_name, ' ', a.user_phone, ' ', a.user_account) AS userShowName,
|
||||
a.user_member_code,
|
||||
a.user_password,
|
||||
a.user_salt,
|
||||
a.role_name,
|
||||
a.organization_name,
|
||||
a.user_pay_password,
|
||||
a.user_idcard_number,
|
||||
a.user_idcard_number_des,
|
||||
a.user_idcard_date_from,
|
||||
a.user_idcard_date_to,
|
||||
a.user_idcard_long,
|
||||
a.user_idcard_front_url,
|
||||
a.user_idcard_back_url,
|
||||
a.user_idcard_inhand_url,
|
||||
a.avatar,
|
||||
a.user_status,
|
||||
a.user_email,
|
||||
a.user_area_county_id,
|
||||
a.user_area_name,
|
||||
a.user_area_address,
|
||||
a.user_wechat_account,
|
||||
a.user_wechat_openid,
|
||||
a.user_wechat_session_key,
|
||||
a.password_wrong_times,
|
||||
a.last_login_time,
|
||||
a.last_login_ip,
|
||||
a.app_openid,
|
||||
a.user_client_id,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag,
|
||||
a.user_remark,
|
||||
a.user_auth_status,
|
||||
a.user_status_remark,
|
||||
a.user_status_time,
|
||||
a.user_account_type,
|
||||
a.user_birthday,
|
||||
a.sex,
|
||||
a.is_driver_bidding,
|
||||
a.certification_authority,
|
||||
a.account_id,
|
||||
a.promo_code,
|
||||
a.user_template_seal_status,
|
||||
a.emergency_contact_name,
|
||||
a.emergency_contact_phone,
|
||||
a.business_type,
|
||||
a.user_template_seal,
|
||||
a.data_sources,
|
||||
a.role_code,
|
||||
a.department_id,
|
||||
a.ding_user_id,
|
||||
a.ding_dept_id,
|
||||
a.validity_period_management
|
||||
FROM `user` a
|
||||
where a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDO"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
|
||||
<include refid="common_where"></include>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectUserShipperList" parameterType="com.mhd.common.core.domain.po.UserPo"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
SELECT
|
||||
u.user_id AS userId,
|
||||
u.user_member_code AS userMemberCode,
|
||||
s.shipper_enterprise_name AS shipperEnterpriseName,
|
||||
u.user_name AS userName,
|
||||
u.user_phone AS userPhone,
|
||||
u.user_idcard_number as userIdcardNumber,
|
||||
u.top_organization_id AS topOrganizationId
|
||||
FROM
|
||||
`user_shipper` s
|
||||
LEFT JOIN
|
||||
`user` u
|
||||
ON u.user_id = s.user_id
|
||||
<where>
|
||||
<if test="topOrganizationId != null "> and u.top_organization_id = #{topOrganizationId}</if>
|
||||
<if test="userMemberCode != null "> and u.user_member_code = #{userMemberCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserShipperListWaybill" parameterType="com.mhd.common.core.domain.po.UserPo"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
SELECT
|
||||
u.user_id AS userId,
|
||||
u.user_member_code AS userMemberCode,
|
||||
s.shipper_enterprise_name AS shipperEnterpriseName,
|
||||
u.user_name AS userName,
|
||||
u.user_phone AS userPhone,
|
||||
u.user_idcard_number as userIdcardNumber,
|
||||
u.top_organization_id AS topOrganizationId
|
||||
FROM
|
||||
`user_shipper` s
|
||||
LEFT JOIN
|
||||
`user` u
|
||||
ON u.user_id = s.user_id and u.del_flag = 1
|
||||
<where>
|
||||
s.del_flag = 1 and s.shipper_fill = 3
|
||||
<if test="topOrganizationId != null "> and u.top_organization_id = #{topOrganizationId}</if>
|
||||
<if test="userMemberCode != null and userMemberCode !='' "> and u.user_member_code = #{userMemberCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
<!-- 根据一级组织ID和用户登录账号查询用户 -->
|
||||
<select id="findByTopOrganizationIdAndUserAccount" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
and a.user_account = #{userAccount}
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<!-- 根据用户钉钉userID查询用户 -->
|
||||
<select id="getUserByDingUserId" parameterType="java.lang.String"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.ding_user_id = #{dingUserId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 根据一级组织ID和职务/角色权限字符role_code查询单个用户 -->
|
||||
<select id="findAdminUserByOrganizationId" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.organization_id = #{organizationId}
|
||||
and a.role_code = #{roleCode}
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByUserId" parameterType="java.lang.Long" resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.user_id = #{value}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据用户手机号查询自己以外的用户 -->
|
||||
<select id="findByTopOrganizationIdAndUserPhone"
|
||||
parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDO"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
and a.user_phone = #{userPhone}
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<!-- 根据用户身份证号查询自己以外的用户 -->
|
||||
<select id="findByTopOrganizationIdAndIdCard"
|
||||
parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDO"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.user_idcard_number = #{userIdcardNumber}
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="createBy != null"> and a.create_by = #{createBy}</if>
|
||||
<if test="userAccountType != null"> and a.user_account_type = #{userAccountType}</if>
|
||||
<if test="userAccountTypeList != null">
|
||||
and a.user_account_type in
|
||||
<foreach item="userAccountType" collection="userAccountTypeList" open="(" separator="," close=")">
|
||||
#{userAccountType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="createBy != null and organizationIdList == null">
|
||||
and a.create_by = #{createBy}</if>
|
||||
<if test="organizationIdList != null and createBy == null">
|
||||
AND a.organization_id in
|
||||
<foreach item="id" collection="organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="organizationIdList != null and createBy != null">
|
||||
AND (a.organization_id in
|
||||
<foreach item="id" collection="organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
OR a.create_by = #{createBy})
|
||||
</if>
|
||||
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
</if>
|
||||
|
||||
<if test="organizationId !=null">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="topOrganizationId !=null">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
/*组织名称*/
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and a.organization_name like concat('%' , #{organizationName} , '%')
|
||||
</if>
|
||||
/*姓名、手机号*/
|
||||
<if test="userInfo != null and userInfo != ''">
|
||||
and (a.user_name like concat('%' , #{userInfo} , '%')
|
||||
or a.user_phone like concat('%' , #{userInfo} , '%'))
|
||||
</if>
|
||||
/*姓名*/
|
||||
<if test="userName != null and userName != ''">
|
||||
and a.user_name like concat('%' , #{userName} , '%')
|
||||
</if>
|
||||
/*登录账号*/
|
||||
<if test="userAccount != null and userAccount != ''">
|
||||
and a.user_account like concat('%' , #{userAccount} , '%')
|
||||
</if>
|
||||
/*手机号*/
|
||||
<if test="userPhone != null and userPhone != ''">
|
||||
and a.user_phone like concat('%' , #{userPhone} , '%')
|
||||
</if>
|
||||
/*身份证号*/
|
||||
<if test="userIdcardNumber != null and userIdcardNumber != ''">
|
||||
and a.user_idcard_number like concat('%' , #{userIdcardNumber} , '%')
|
||||
</if>
|
||||
/*角色*/
|
||||
<if test="roleCode != null and roleCode != ''">
|
||||
and a.role_code like concat('%' , #{roleCode} , '%')
|
||||
</if>
|
||||
/*角色*/
|
||||
<if test="roleName != null and roleName != ''">
|
||||
and a.role_name like concat('%' , #{roleName} , '%')
|
||||
</if>
|
||||
/*实名认证状态*/
|
||||
<if test="userAuthStatus != null and userAuthStatus != ''">
|
||||
and a.user_auth_status = #{userAuthStatus}
|
||||
</if>
|
||||
/*身份证有效期*/
|
||||
<if test="userIdcardDateFrom!=null and userIdcardDateTo!=null ">
|
||||
and DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{userIdcardDateFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{userIdcardDateTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/*详细地址*/
|
||||
<if test="userAreaAddressInfo != null and userAreaAddressInfo != ''">
|
||||
and a.user_area_address like concat('%' , #{userAreaAddressInfo} , '%')
|
||||
</if>
|
||||
/*用户电子签章状态 0-无状态,1-已创建,2-未创建*/
|
||||
<if test="userTemplateSealStatus != null and userTemplateSealStatus != '' and userTemplateSealStatus==1">
|
||||
and a.user_template_seal is not null
|
||||
and a.user_template_seal != ''
|
||||
</if>
|
||||
/*用户电子签章状态 0-无状态,1-已创建,2-未创建*/
|
||||
<if test="userTemplateSealStatus != null and userTemplateSealStatus != '' and userTemplateSealStatus==2">
|
||||
and (a.user_template_seal is null or a.user_template_seal = '')
|
||||
</if>
|
||||
/*用户三方支付账号状态 0-无状态,1-已创建,2-未创建*/
|
||||
<if test="userPayAccountStatus != null and userPayAccountStatus != '' and userPayAccountStatus==1">
|
||||
and a.user_pay_account is not null
|
||||
and a.user_pay_account != ''
|
||||
</if>
|
||||
/*用户三方支付账号状态 0-无状态,1-已创建,2-未创建*/
|
||||
<if test="userPayAccountStatus != null and userPayAccountStatus != '' and userPayAccountStatus==2">
|
||||
and ( a.user_pay_account is null or a.user_pay_account ='')
|
||||
</if>
|
||||
/*用户三方支付账号*/
|
||||
<if test="userPayAccount != null and userPayAccount != ''">
|
||||
and a.user_pay_account like concat('%' , #{userPayAccount} , '%')
|
||||
</if>
|
||||
/*用户绑卡账号*/
|
||||
<if test="userBankCardAccount != null and userBankCardAccount != ''">
|
||||
and a.user_bankcard_account like concat('%' , #{userBankCardAccount} , '%')
|
||||
</if>
|
||||
|
||||
/*用户绑卡状态:0-无状态,1-已绑卡,2-未绑卡*/
|
||||
<if test="userBankCardStatus != null and userBankCardStatus != '' and userBankCardStatus==1">
|
||||
and a.user_bankcard_account is not null
|
||||
and a.user_bankcard_account != ''
|
||||
</if>
|
||||
/*用户绑卡状态:0-无状态,1-已绑卡,2-未绑卡*/
|
||||
<if test="userBankCardStatus != null and userBankCardStatus != '' and userBankCardStatus==2">
|
||||
and ( a.user_bankcard_account is null or a.user_bankcard_account= '')
|
||||
</if>
|
||||
|
||||
/*用户状态:0-无状态,1-正常,2-锁定*/
|
||||
<if test="userStatus != null and userStatus != ''">
|
||||
and a.user_status = #{userStatus}
|
||||
</if>
|
||||
|
||||
/*最近一次登录时间*/
|
||||
<if test="lastLoginTimeFrom!=null and lastLoginTimeTo!=null ">
|
||||
and DATE_FORMAT(a.last_login_time,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{lastLoginTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.last_login_time,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{lastLoginTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
|
||||
/*添加人员*/
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and a.create_by_name like concat('%' , #{createByName} , '%')
|
||||
</if>
|
||||
|
||||
/*审核人员*/
|
||||
<if test="userAuthByUsername != null and userAuthByUsername != ''">
|
||||
and a.user_auth_by like concat('%' , #{userAuthByUsername} , '%')
|
||||
</if>
|
||||
/*审核人员*/
|
||||
<if test="userAuthByUsername != null and userAuthByUsername != ''">
|
||||
and a.user_auth_by_username like concat('%' , #{userAuthByUsername} , '%')
|
||||
</if>
|
||||
|
||||
/*添加时间*/
|
||||
<if test="createTime!=null and createTime!=null ">
|
||||
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{createTime},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{createTime},'%Y-%m-%d')
|
||||
</if>
|
||||
/*添加时间*/
|
||||
<if test="createTimeFrom!=null and createTimeTo!=null ">
|
||||
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{createTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{createTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/*审核时间*/
|
||||
<if test="userAuthTimeFrom!=null and userAuthTimeTo!=null ">
|
||||
and DATE_FORMAT(a.user_auth_time,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{userAuthTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.user_auth_time,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{userAuthTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/* 身份证状态:用户身份证到期状态:0-无状态,1-正常,2-临期一个月,3-临期三个月,4-过期,5-长期 */
|
||||
/* 正常: 直接赋值,查询当前时间小于过期时间的 */
|
||||
<if test="userIdcardStatus == 1 ">
|
||||
and DATE_FORMAT(#{userIdcardTime},'%Y-%m-%d') <![CDATA[<]]> DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d')
|
||||
</if>
|
||||
/* 临期一个月:当前时间加一个月,查询该时间大于过期时间的 临期三个月:当前时间加三个月,查询该时间大于过期时间的*/
|
||||
<if test="userIdcardStatus == 2 or userIdcardStatus == 3">
|
||||
and DATE_FORMAT(#{userIdcardTimeAdd},'%Y-%m-%d') <![CDATA[>=]]> a.user_idcard_date_to
|
||||
and DATE_FORMAT(#{userIdcardTime},'%Y-%m-%d') <![CDATA[<=]]> a.user_idcard_date_to
|
||||
</if>
|
||||
/* 过期:查询当前时间大于过期时间的*/
|
||||
<if test="userIdcardStatus == 4 ">
|
||||
and DATE_FORMAT(#{userIdcardTime},'%Y-%m-%d') <![CDATA[>]]> DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d')
|
||||
</if>
|
||||
/* 长期:查询 user_idcard_long字段为1的*/
|
||||
<if test="userIdcardStatus == 5 ">
|
||||
and a.user_idcard_long = 1
|
||||
</if>
|
||||
/*用户编码*/
|
||||
<if test="userMemberCode != null and userMemberCode != ''">
|
||||
and a.user_member_code = #{userMemberCode}
|
||||
</if>
|
||||
/*联系人*/
|
||||
<if test="emergencyContactName != null and emergencyContactName != ''">
|
||||
and a.emergency_contact_name = #{emergencyContactName}
|
||||
</if>
|
||||
/*联系电话*/
|
||||
<if test="emergencyContactPhone != null and emergencyContactPhone != ''">
|
||||
and a.emergency_contact_phone = #{emergencyContactPhone}
|
||||
</if>
|
||||
/*详细地址*/
|
||||
<if test="userAreaAddress != null and userAreaAddress != ''">
|
||||
and a.user_area_address like concat('%' , #{userAreaAddress} , '%')
|
||||
</if>
|
||||
/*紧急联系人*/
|
||||
<if test="emergencyContactName != null and emergencyContactName != ''">
|
||||
and a.emergency_contact_name like concat('%' , #{emergencyContactName} , '%')
|
||||
</if>
|
||||
/*紧急联系人手机号*/
|
||||
<if test="emergencyContactPhone != null and emergencyContactPhone != ''">
|
||||
and a.emergency_contact_phone like concat('%' , #{emergencyContactPhone} , '%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectAppUserList" resultType="com.mhd.common.core.domain.po.app.UserAppPo" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDO">
|
||||
SELECT
|
||||
a.user_id,
|
||||
a.top_organization_id,
|
||||
a.organization_id,
|
||||
a.organization_name,
|
||||
a.user_name,
|
||||
a.user_phone,
|
||||
a.user_account,
|
||||
a.avatar
|
||||
FROM
|
||||
`user` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where1"></include>
|
||||
</select>
|
||||
|
||||
<sql id="common_where1">
|
||||
<if test="userDO.userPhone != null and userDO.userPhone != ''">
|
||||
and (a.user_phone = #{userDO.userPhone} or a.user_account = #{userDO.userPhone})
|
||||
</if>
|
||||
<if test="userDO.topOrganizationId !=null">
|
||||
and a.top_organization_id = #{userDO.topOrganizationId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getCaptainAuthInfoByUserId"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverCaptainAuthPo">
|
||||
select u.user_id,
|
||||
u.user_phone,
|
||||
u.user_name,
|
||||
u.user_account,
|
||||
u.user_idcard_number,
|
||||
u.user_idcard_date_from,
|
||||
u.user_idcard_date_to,
|
||||
u.user_idcard_long,
|
||||
u.user_idcard_front_url,
|
||||
u.user_idcard_back_url,
|
||||
u.user_idcard_inhand_url,
|
||||
u.avatar,
|
||||
u.user_area_county_id,
|
||||
u.user_area_name,
|
||||
u.user_area_address,
|
||||
u.user_birthday,
|
||||
ude.driver_captain_fill
|
||||
from user_driver_enterprise ude
|
||||
left join user u on ude.user_id = u.user_id and u.del_flag = 1
|
||||
where ude.del_flag = 1
|
||||
and ude.driver_type = 2
|
||||
and u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="getDocumentWarningList"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserDocumentWarningQueryPo"
|
||||
parameterType="com.mhd.user.interfaces.dto.queryDTO.UserDocumentWarningQueryDTO">
|
||||
select u.user_id,
|
||||
u.user_account,
|
||||
u.user_name,
|
||||
dvb.vehicle_license_plate_number,
|
||||
(case
|
||||
when instr(roleCode, 'driver') > 0 or instr(roleCode, 'carrier') > 0 or
|
||||
instr(roleCode, 'captain') > 0
|
||||
then 1 end) as type,
|
||||
u.user_idcard_date_to,
|
||||
u.user_idcard_long,
|
||||
ude.driver_enterprise_license_date_to,
|
||||
ude.driver_enterprise_license_long,
|
||||
ude.driver_business_license_date_to,
|
||||
ude.driver_business_license_long,
|
||||
ud.driver_license_date_to,
|
||||
ud.driver_license_long,
|
||||
ud.driver_work_license_date_to,
|
||||
ud.driver_work_license_long,
|
||||
dvb.vehicle_checkout_period_validity,
|
||||
dvb.business_license_expire_end_date,
|
||||
dvb.business_license_long_status,
|
||||
dvb.road_transport_certificate_expire_date,
|
||||
dvb.road_transport_certificate_long_status,
|
||||
(if(u.user_idcard_long = 1, 4,
|
||||
(case
|
||||
when datediff(u.user_idcard_date_to, NOW()) > 30 then 1
|
||||
when datediff(u.user_idcard_date_to, NOW()) < 30
|
||||
and datediff(u.user_idcard_date_to, NOW()) > 0 then 3
|
||||
when datediff(u.user_idcard_date_to, NOW()) < 0 then 2
|
||||
else 0
|
||||
end))) as idCardExpStatus,
|
||||
(if(ude.driver_enterprise_license_long = 1, 4,
|
||||
(case
|
||||
when datediff(ude.driver_enterprise_license_date_to, NOW()) > 30 then 1
|
||||
when datediff(ude.driver_enterprise_license_date_to, NOW()) < 30
|
||||
and datediff(ude.driver_enterprise_license_date_to, NOW()) > 0 then 3
|
||||
when datediff(ude.driver_enterprise_license_date_to, NOW()) < 0 then 2
|
||||
else 0
|
||||
end))) as businessLicenseStatus,
|
||||
(if(ud.driver_license_long = 1, 4,
|
||||
(case
|
||||
when datediff(ud.driver_license_date_to, NOW()) > 30 then 1
|
||||
when datediff(ud.driver_license_date_to, NOW()) < 30
|
||||
and datediff(ud.driver_license_date_to, NOW()) > 0 then 3
|
||||
when datediff(ud.driver_license_date_to, NOW()) < 0 then 2
|
||||
else 0
|
||||
end))) as driverLicenseExpStatus,
|
||||
(if(ud.driver_work_license_long = 1, 4,
|
||||
(case
|
||||
when datediff(ud.driver_work_license_date_to, NOW()) > 30 then 1
|
||||
when datediff(ud.driver_work_license_date_to, NOW()) < 30
|
||||
and datediff(ud.driver_work_license_date_to, NOW()) > 0 then 3
|
||||
when datediff(ud.driver_work_license_date_to, NOW()) < 0 then 2
|
||||
else 0
|
||||
end))) as workCertificateExpStatus,
|
||||
(if(dvb.business_license_long_status = 1, 4,
|
||||
(case
|
||||
when datediff(dvb.business_license_expire_end_date, NOW()) > 30 then 1
|
||||
when datediff(dvb.business_license_expire_end_date, NOW()) < 30
|
||||
and datediff(dvb.business_license_expire_end_date, NOW()) > 0 then 3
|
||||
when datediff(dvb.business_license_expire_end_date, NOW()) < 0 then 2
|
||||
else 0
|
||||
end))) as businessLicenseExpStatus,
|
||||
(if(dvb.road_transport_certificate_long_status = 1, 4,
|
||||
(case
|
||||
when datediff(dvb.road_transport_certificate_expire_date, NOW()) > 30 then 1
|
||||
when datediff(dvb.road_transport_certificate_expire_date, NOW()) < 30
|
||||
and datediff(dvb.road_transport_certificate_expire_date, NOW()) > 0 then 3
|
||||
when datediff(dvb.road_transport_certificate_expire_date, NOW()) < 0 then 2
|
||||
else 0
|
||||
end))) as transportPermitExpStatus,
|
||||
(case
|
||||
when datediff(dvb.vehicle_checkout_period_validity, NOW()) > 30 then 1
|
||||
when datediff(dvb.vehicle_checkout_period_validity, NOW()) < 30
|
||||
and datediff(dvb.vehicle_checkout_period_validity, NOW()) > 0 then 3
|
||||
when datediff(dvb.vehicle_checkout_period_validity, NOW()) < 0 then 2
|
||||
else 0
|
||||
end) as drivingPermitExpStatus
|
||||
from user u
|
||||
left join user_driver ud on u.user_id = ud.user_id and ud.del_flag = 1
|
||||
left join user_driver_enterprise ude on u.user_id = ude.user_id and ude.del_flag = 1 and ude.driver_type = 1
|
||||
left join driver_vehicle_bind dvb
|
||||
on u.user_id = dvb.driver_bind_id and dvb.del_flag = 1 and dvb.default_flag = 1
|
||||
left join (select ur.user_id, group_concat(r.role_code) as roleCode
|
||||
from role r
|
||||
left join user_role ur on r.role_id = ur.role_id
|
||||
<where>
|
||||
r.del_flag = 1
|
||||
and ur.del_flag = 1
|
||||
<if test="userDocumentWarningQueryDTO.type != null and userDocumentWarningQueryDTO.type == 0">
|
||||
and role_code in ('shipper','company')
|
||||
</if>
|
||||
<if test="userDocumentWarningQueryDTO.type != null and userDocumentWarningQueryDTO.type == 1">
|
||||
and role_code in ('driver', 'carrier', 'captain')
|
||||
</if>
|
||||
<if test="userDocumentWarningQueryDTO.type == null">
|
||||
and role_code in ('driver','carrier', 'captain','shipper','company')
|
||||
</if>
|
||||
</where>
|
||||
group by ur.user_id) r on r.user_id = u.user_id
|
||||
<where>
|
||||
u.del_flag = 1
|
||||
and r.roleCode is not null
|
||||
<!-- 用户名称 -->
|
||||
<if test=" userDocumentWarningQueryDTO.userName != null and userDocumentWarningQueryDTO.userName != ''">
|
||||
and u.user_name LIKE CONCAT('%',#{ userDocumentWarningQueryDTO.userName},'%')
|
||||
</if>
|
||||
<!-- 用户账号 -->
|
||||
<if test=" userDocumentWarningQueryDTO.userAccount != null and userDocumentWarningQueryDTO.userAccount != ''">
|
||||
and u.user_account LIKE CONCAT('%',#{ userDocumentWarningQueryDTO.userAccount},'%')
|
||||
</if>
|
||||
<!-- 身份证临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'a'.toString()">
|
||||
and (datediff(u.user_idcard_date_to, NOW()) < 30
|
||||
and datediff(u.user_idcard_date_to, NOW()) > 0
|
||||
and u.user_idcard_long != 1)
|
||||
</if>
|
||||
<!-- 身份证过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'h'.toString()">
|
||||
and (datediff(u.user_idcard_date_to, NOW()) < 0
|
||||
and u.user_idcard_long != 1)
|
||||
</if>
|
||||
<!-- 营业执照临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'b'.toString()">
|
||||
and (datediff(ude.driver_enterprise_license_date_to, NOW()) < 30
|
||||
and datediff(ude.driver_enterprise_license_date_to, NOW()) > 0
|
||||
and ude.driver_enterprise_license_long != 1)
|
||||
</if>
|
||||
<!-- 营业执照过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'i'.toString()">
|
||||
and (datediff(ude.driver_enterprise_license_date_to, NOW()) < 0
|
||||
and ude.driver_enterprise_license_long != 1)
|
||||
</if>
|
||||
<!-- 驾驶证临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'c'.toString()">
|
||||
and (datediff(ud.driver_license_date_to, NOW()) < 30
|
||||
and datediff(ud.driver_license_date_to, NOW()) > 0
|
||||
and ud.driver_license_long != 1)
|
||||
</if>
|
||||
<!-- 驾驶证过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'j'.toString()">
|
||||
and (datediff(ud.driver_license_date_to, NOW()) < 0
|
||||
and ud.driver_license_long != 1)
|
||||
</if>
|
||||
<!-- 从业资格证临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'd'.toString()">
|
||||
and (datediff(ud.driver_work_license_date_to, NOW()) < 30
|
||||
and datediff(ud.driver_work_license_date_to, NOW()) > 0
|
||||
and ud.driver_work_license_long != 1)
|
||||
</if>
|
||||
<!-- 从业资格证过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'k'.toString()">
|
||||
and (datediff(ud.driver_work_license_date_to, NOW()) < 0
|
||||
and ud.driver_work_license_long != 1)
|
||||
</if>
|
||||
<!-- 行驶证临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'e'.toString()">
|
||||
and (datediff(dvb.vehicle_checkout_period_validity, NOW()) < 30 and datediff(dvb.vehicle_checkout_period_validity, NOW()) > 0)
|
||||
</if>
|
||||
<!-- 行驶证过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'l'.toString()">
|
||||
and datediff(dvb.vehicle_checkout_period_validity, NOW()) < 0
|
||||
</if>
|
||||
<!-- 道路运输许可证临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'f'.toString()">
|
||||
and (datediff(dvb.road_transport_certificate_expire_date, NOW()) < 30
|
||||
and datediff(dvb.road_transport_certificate_expire_date, NOW()) > 0
|
||||
and dvb.road_transport_certificate_long_status != 1)
|
||||
</if>
|
||||
<!-- 道路运输许可证过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'm'.toString()">
|
||||
and (datediff(dvb.road_transport_certificate_expire_date, NOW()) < 0
|
||||
and dvb.road_transport_certificate_long_status != 1)
|
||||
</if>
|
||||
<!-- 道路运输经营许可证临期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'g'.toString()">
|
||||
and (datediff(dvb.business_license_expire_end_date, NOW()) < 30
|
||||
and datediff(dvb.business_license_expire_end_date, NOW()) > 0
|
||||
and dvb.business_license_long_status != 1)
|
||||
</if>
|
||||
<!-- 道路运输经营许可证过期 -->
|
||||
<if test=" userDocumentWarningQueryDTO.seach != null and userDocumentWarningQueryDTO.seach != '' and userDocumentWarningQueryDTO.seach == 'n'.toString()">
|
||||
and (datediff(dvb.business_license_expire_end_date, NOW()) < 0
|
||||
and dvb.business_license_long_status != 1)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findByPromoCode" resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.promo_code = #{promoCode}
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getAllShipperByOrganization"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserShipperPo">
|
||||
SELECT
|
||||
u.user_id,
|
||||
u.user_name,
|
||||
us.shipper_enterprise_name,
|
||||
us.shipper_type
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN user_shipper us ON u.user_id = us.user_id
|
||||
WHERE
|
||||
u.del_flag = 1
|
||||
AND us.del_flag = 1
|
||||
AND ((us.shipper_type = 1 AND us.shipper_fill = 3)
|
||||
OR ( us.shipper_type = 2 AND us.shipper_enterprise_fill = 3 ))
|
||||
AND top_organization_id = #{topOrganizationId}
|
||||
</select>
|
||||
|
||||
<select id="getAllDriverByOrganization"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo">
|
||||
SELECT
|
||||
u.user_id,
|
||||
u.user_name,
|
||||
ude.driver_enterprise_name,
|
||||
ude.driver_type
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN user_driver_enterprise ude ON u.user_id = ude.user_id
|
||||
WHERE
|
||||
u.del_flag = 1
|
||||
AND ude.del_flag = 1
|
||||
AND ((
|
||||
ude.driver_type = 1
|
||||
AND ude.driver_enterprise_fill = 3
|
||||
)
|
||||
OR ( ude.driver_type = 2 AND ude.driver_captain_fill = 3 ))
|
||||
AND top_organization_id = #{topOrganizationId}
|
||||
</select>
|
||||
|
||||
<select id="selectAppUserListByRoleCode" resultType="com.mhd.common.core.domain.po.app.UserAppPo" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDO">
|
||||
SELECT
|
||||
a.user_id,
|
||||
a.top_organization_id,
|
||||
a.organization_id,
|
||||
a.organization_name,
|
||||
a.user_name,
|
||||
a.user_phone,
|
||||
a.user_account,
|
||||
a.avatar
|
||||
FROM
|
||||
`user` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
and a.role_code = #{roleCode}
|
||||
</select>
|
||||
|
||||
<select id="findAllShipperInfo" resultType="com.mhd.user.interfaces.vo.QueryAllShipperInfoVo">
|
||||
SELECT u.user_id, u.user_name, u.user_area_address, u.user_area_county_id, u.user_area_name ,u.user_phone,u.has_default_address,b.shipper_id,b.shipper_enterprise_name
|
||||
FROM `user` u
|
||||
LEFT JOIN `user_shipper` b ON u.user_id = b.user_id
|
||||
left join (select user_id, GROUP_CONCAT(r.role_name separator '&') roleName
|
||||
from role r
|
||||
left join user_role ur on r.role_id = ur.role_id and ur.del_flag = 1
|
||||
where r.del_flag = 1
|
||||
and role_code in ('shipper', 'company')
|
||||
group by user_id) r on r.user_id = u.user_id
|
||||
WHERE u.del_flag = 1
|
||||
AND (b.del_flag = 1 OR b.del_flag IS NULL)
|
||||
AND u.business_type IN (1,3)
|
||||
<if test="userId !=null">
|
||||
AND u.user_Id = #{userId}
|
||||
</if>
|
||||
/*一级组织ID*/
|
||||
<if test="topOrganizationId !=null">
|
||||
AND u.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
GROUP BY u.user_id
|
||||
</select>
|
||||
<select id="finShipperEnterpriseNamedByUserId" resultType="string">
|
||||
SELECT
|
||||
user_shipper.shipper_enterprise_name
|
||||
FROM
|
||||
`user` u
|
||||
INNER JOIN
|
||||
`user_shipper` ON u.user_id = user_shipper.user_id
|
||||
WHERE
|
||||
u.del_flag = 1
|
||||
AND user_shipper.del_flag = 1
|
||||
AND u.business_type IN (1, 3)
|
||||
AND u.user_Id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserMenuMapper">
|
||||
|
||||
<sql id="selectUserMenuVo">
|
||||
SELECT
|
||||
a.user_menu_id,
|
||||
a.user_id,
|
||||
a.menu_id
|
||||
FROM
|
||||
`user_menu` a
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserMenuDo"
|
||||
resultType="com.mhd.user.domain.userAggregate.entity.UserMenuEntity">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
|
||||
<select id="selectUserMenuList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserMenuDo"
|
||||
resultType="com.mhd.common.core.domain.po.UserRoleMenuPO">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
|
||||
<select id="selectByUserMenuId" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserMenuDo"
|
||||
resultType="com.mhd.user.domain.userAggregate.entity.UserMenuEntity">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
AND a.menu_id IN (
|
||||
SELECT menu_id FROM role_menu rm LEFT JOIN user_role ur ON rm.role_id = ur.role_id WHERE ur.user_id = #{userId})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="deleteByUserId" parameterType="java.lang.Long" >
|
||||
DELETE
|
||||
FROM
|
||||
`user_menu` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.user_id = #{value}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserRoleMapper">
|
||||
|
||||
<sql id="selectUserMenuVo">
|
||||
SELECT
|
||||
a.user_role_id,
|
||||
a.user_id,
|
||||
a.role_id
|
||||
FROM
|
||||
`user_role` a
|
||||
</sql>
|
||||
<select id="userRoleMenuList" resultType="com.mhd.common.core.domain.po.UserRoleMenuPO">
|
||||
SELECT
|
||||
a.role_id,
|
||||
a.user_id,
|
||||
b.menu_id
|
||||
FROM
|
||||
user_role a
|
||||
LEFT JOIN role_menu b ON a.role_id = b.role_id
|
||||
WHERE a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserRoleDo"
|
||||
resultType="com.mhd.user.domain.userAggregate.entity.UserRoleEntity">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
<select id="selectUserRoleList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserRoleDo"
|
||||
resultType="com.mhd.common.core.domain.po.UserRoleMenuPO">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
<select id="deleteByUserId" parameterType="java.lang.Long" >
|
||||
DELETE
|
||||
FROM
|
||||
`user_role` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRolesByUserId" resultType="com.mhd.common.core.domain.po.UserRoleMenuPO" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
ur.user_role_id,
|
||||
ur.role_id,
|
||||
ur.user_id,
|
||||
r.role_name,
|
||||
r.role_code
|
||||
FROM
|
||||
user_role ur
|
||||
LEFT JOIN role r ON ur.role_id = r.role_id
|
||||
AND r.del_flag = 1
|
||||
WHERE ur.del_flag = 1
|
||||
AND ur.user_id = #{userid}
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
</if>
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and a.role_id = #{roleId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getUserIdByRoleCode" resultType="java.lang.Long">
|
||||
select
|
||||
u.user_id
|
||||
from user u
|
||||
left join user_role ur on u.user_id = ur.user_id and ur.del_flag = 1
|
||||
left join role r on r.role_id = ur.role_id and r.del_flag = 1
|
||||
<where>
|
||||
u.del_flag = 1
|
||||
and u.top_organization_id = #{topOrganizationId}
|
||||
and r.role_code in
|
||||
<foreach item="code" collection="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</where>
|
||||
group by u.user_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,381 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper">
|
||||
|
||||
<sql id="selectShipperVo">
|
||||
SELECT a.shipper_id,
|
||||
a.user_id,
|
||||
a.parent_shipper_id,
|
||||
a.shipper_type,
|
||||
a.shipper_enterprise_name,
|
||||
a.shipper_enterprise_social_credit_code,
|
||||
a.shipper_enterprise_phone,
|
||||
a.shipper_enterprise_address,
|
||||
a.shipper_enterprise_license_date_from,
|
||||
a.shipper_enterprise_license_date_to,
|
||||
a.shipper_enterprise_taxpayer,
|
||||
a.shipper_enterprise_license_long,
|
||||
a.shipper_enterprise_license_front_url,
|
||||
a.shipper_corp,
|
||||
a.shipper_corp_name,
|
||||
a.shipper_corp_legal_name,
|
||||
a.shipper_corp_idcard_number,
|
||||
a.shipper_corp_idcard_number_des,
|
||||
a.shipper_corp_idcard_date_from,
|
||||
a.shipper_corp_idcard_date_to,
|
||||
a.shipper_corp_idcard_long,
|
||||
a.shipper_corp_idcard_front_url,
|
||||
a.shipper_corp_idcard_back_url,
|
||||
a.shipper_corp_idcard_inhand_url,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag,
|
||||
a.shipper_fill,
|
||||
a.shipper_fill_time,
|
||||
a.shipper_enterprise_fill,
|
||||
a.shipper_enterprise_fill_time,
|
||||
a.shipper_fill_remark,
|
||||
a.shipper_enterprise_fill_remark,
|
||||
b.user_phone,
|
||||
b.user_name,
|
||||
b.role_name,
|
||||
b.organization_name,
|
||||
b.user_account,
|
||||
b.user_member_code,
|
||||
b.user_idcard_number,
|
||||
b.user_idcard_date_from,
|
||||
b.user_idcard_date_to,
|
||||
b.user_idcard_long,
|
||||
b.user_idcard_front_url,
|
||||
b.user_idcard_back_url,
|
||||
b.user_idcard_inhand_url,
|
||||
b.user_area_county_id,
|
||||
b.user_area_name,
|
||||
b.user_area_address,
|
||||
b.user_remark,
|
||||
b.avatar,
|
||||
b.user_birthday,
|
||||
a.company_account_id,
|
||||
a.esign_auth_status,
|
||||
a.esign_enterprise_status,
|
||||
a.esign_seal_auth_id
|
||||
FROM `user_shipper` a
|
||||
LEFT JOIN `user` b ON a.user_id = b.user_id
|
||||
WHERE a.del_flag = 1
|
||||
AND b.del_flag = 1
|
||||
</sql>
|
||||
<sql id="selectShipperVo1">
|
||||
SELECT b.shipper_id,
|
||||
a.user_id,
|
||||
b.parent_shipper_id,
|
||||
b.shipper_type,
|
||||
b.shipper_enterprise_name,
|
||||
b.shipper_enterprise_social_credit_code,
|
||||
b.shipper_enterprise_phone,
|
||||
b.shipper_enterprise_address,
|
||||
b.shipper_enterprise_license_date_from,
|
||||
b.shipper_enterprise_license_date_to,
|
||||
b.shipper_enterprise_taxpayer,
|
||||
b.shipper_enterprise_license_long,
|
||||
b.shipper_enterprise_license_front_url,
|
||||
b.shipper_corp,
|
||||
b.shipper_corp_name,
|
||||
b.shipper_corp_legal_name,
|
||||
b.shipper_corp_idcard_number,
|
||||
b.shipper_corp_idcard_number_des,
|
||||
b.shipper_corp_idcard_date_from,
|
||||
b.shipper_corp_idcard_date_to,
|
||||
b.shipper_corp_idcard_long,
|
||||
b.shipper_corp_idcard_front_url,
|
||||
b.shipper_corp_idcard_back_url,
|
||||
b.shipper_corp_idcard_inhand_url,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
b.del_flag,
|
||||
b.shipper_fill,
|
||||
b.shipper_fill_time,
|
||||
b.shipper_enterprise_fill,
|
||||
b.shipper_enterprise_fill_time,
|
||||
b.shipper_fill_remark,
|
||||
b.shipper_enterprise_fill_remark,
|
||||
b.shipper_fill_auth_id,
|
||||
b.shipper_fill_auth_name,
|
||||
b.shipper_enterprisel_auth_name,
|
||||
b.shipper_enterprisel_auth_id,
|
||||
a.user_phone,
|
||||
a.user_name,
|
||||
a.organization_name,
|
||||
a.user_account,
|
||||
a.user_member_code,
|
||||
a.user_idcard_number,
|
||||
a.user_idcard_date_from,
|
||||
a.user_idcard_date_to,
|
||||
a.user_idcard_long,
|
||||
a.user_idcard_front_url,
|
||||
a.user_idcard_back_url,
|
||||
a.user_idcard_inhand_url,
|
||||
a.user_area_county_id,
|
||||
a.user_area_name,
|
||||
a.user_area_address,
|
||||
a.user_remark,
|
||||
a.avatar,
|
||||
a.user_birthday,
|
||||
b.authorized_quota,
|
||||
b.settlement_day,
|
||||
b.remark,
|
||||
b.authorized_used_amount,
|
||||
r.roleName,
|
||||
b.is_auto_audit_order,
|
||||
b.monthly_settlement_flag,
|
||||
a.user_auth_status,
|
||||
b.original_receipt_flag,
|
||||
b.freight_node
|
||||
FROM `user` a
|
||||
LEFT JOIN `user_shipper` b ON a.user_id = b.user_id
|
||||
left join (select user_id, GROUP_CONCAT(r.role_name separator '&') roleName
|
||||
from role r
|
||||
left join user_role ur on r.role_id = ur.role_id and ur.del_flag = 1
|
||||
where r.del_flag = 1
|
||||
and role_code in ('shipper', 'company')
|
||||
group by user_id) r on r.user_id = a.user_id
|
||||
WHERE a.del_flag = 1
|
||||
AND (b.del_flag = 1 OR b.del_flag IS NULL)
|
||||
AND a.business_type IN (1,3)
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserShipperDO"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserShipperPo">
|
||||
<include refid="selectShipperVo1"/>
|
||||
<include refid="common_where"></include>
|
||||
GROUP BY a.user_id
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectByUserId" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserShipperPo">
|
||||
<include refid="selectShipperVo"/>
|
||||
and a.user_id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="findByShipperId" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.user.domain.userAggregate.repository.po.UserShipperPo">
|
||||
<include refid="selectShipperVo"/>
|
||||
and a.shipper_id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="findByUserId" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity">
|
||||
<include refid="selectShipperVo"/>
|
||||
and a.user_id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="userShipperAndRoleList" resultType="com.mhd.user.domain.userAggregate.repository.po.UserShipperPo" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserShipperDO">
|
||||
SELECT
|
||||
b.shipper_id,
|
||||
a.user_id,
|
||||
GROUP_CONCAT(r.role_code) AS roleCode,
|
||||
b.shipper_fill,
|
||||
b.shipper_enterprise_fill,
|
||||
a.business_type
|
||||
FROM
|
||||
`user` a
|
||||
LEFT JOIN `user_shipper` b ON b.user_id = a.user_id
|
||||
LEFT JOIN user_role ur ON b.user_id = ur.user_id
|
||||
LEFT JOIN `role` r ON ur.role_id = r.role_id
|
||||
AND r.del_flag = 1
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
AND (b.del_flag = 1 OR b.del_flag IS NULL)
|
||||
AND a.business_type IN (1,3)
|
||||
<include refid="common_where"></include>
|
||||
GROUP BY
|
||||
a.user_id
|
||||
ORDER BY
|
||||
a.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="userId !=null">
|
||||
and a.user_Id = #{userId}
|
||||
</if>
|
||||
/*一级组织ID*/
|
||||
<if test="topOrganizationId !=null">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="parentShipperId !=null">
|
||||
and b.parent_shipper_id = #{parentShipperId}
|
||||
</if>
|
||||
/*用户组织ID*/
|
||||
<if test="organizationId !=null">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
/*组织名称*/
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and a.organization_name like concat('%' , #{organizationName} , '%')
|
||||
</if>
|
||||
/*姓名*/
|
||||
<!-- <if test="userName != null and userName != ''">-->
|
||||
<!-- and b.user_name like concat('%' , #{userName} , '%')-->
|
||||
<!-- </if>-->
|
||||
/*姓名/手机号/邮箱*/
|
||||
<if test="userName != null and userName != ''">
|
||||
AND concat( a.user_name, a.user_phone, a.user_email ) LIKE concat ('%' , #{userName} , '%')
|
||||
</if>
|
||||
/*登录账号*/
|
||||
<if test="userAccount != null and userAccount != ''">
|
||||
and a.user_account like concat('%' , #{userAccount} , '%')
|
||||
</if>
|
||||
/*手机号*/
|
||||
<if test="userPhone != null and userPhone != ''">
|
||||
and a.user_phone like concat('%' , #{userPhone} , '%')
|
||||
</if>
|
||||
/*身份证号*/
|
||||
<if test="userIdcardNumber != null and userIdcardNumber != ''">
|
||||
and a.user_idcard_number like concat('%' , #{userIdcardNumber} , '%')
|
||||
</if>
|
||||
/*角色*/
|
||||
<if test="roleName != null and roleName != ''">
|
||||
and r.roleName like concat('%' , #{roleName} , '%')
|
||||
</if>
|
||||
/*实名认证状态*/
|
||||
<if test="userAuthStatus != null and userAuthStatus != ''">
|
||||
and a.user_auth_status = #{userAuthStatus}
|
||||
</if>
|
||||
/*托运人认证*/
|
||||
<if test="shipperAuthStatus != null and shipperAuthStatus != ''">
|
||||
and b.shipper_fill = #{shipperAuthStatus}
|
||||
</if>
|
||||
/*托运企业认证*/
|
||||
<if test="shipperEnterpriseFill != null and shipperEnterpriseFill != ''">
|
||||
and b.shipper_enterprise_fill = #{shipperEnterpriseFill}
|
||||
</if>
|
||||
/*身份证有效期*/
|
||||
<if test="userIdcardDateFrom!=null and userIdcardDateTo!=null ">
|
||||
and DATE_FORMAT(a.user_idcard_date_from,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{userIdcardDateFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{userIdcardDateTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/*详细地址*/
|
||||
<if test="userAreaAddress != null and userAreaAddress != ''">
|
||||
and a.user_area_address like concat('%' , #{userAreaAddress} , '%')
|
||||
</if>
|
||||
/*添加人员*/
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and a.create_by_name like concat('%' , #{createByName} , '%')
|
||||
</if>
|
||||
/*审核人员*/
|
||||
<if test="shipperAuthByUsername != null and shipperAuthByUsername != ''">
|
||||
and b.shipper_fill_auth_name like concat('%' , #{shipperAuthByUsername} , '%')
|
||||
</if>
|
||||
/*添加时间*/
|
||||
<if test="createTimeFrom!=null and createTimeTo!=null ">
|
||||
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{createTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{createTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/*审核时间*/
|
||||
<if test="userAuthTimeFrom!=null and userAuthTimeTo!=null ">
|
||||
and DATE_FORMAT(b.shipper_fill_time,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{userAuthTimeFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(b.shipper_fill_time,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{userAuthTimeTo},'%Y-%m-%d')
|
||||
</if>
|
||||
|
||||
/*企业名称*/
|
||||
<if test="shipperEnterpriseName != null and shipperEnterpriseName != ''">
|
||||
and b.shipper_enterprise_name like concat('%' , #{shipperEnterpriseName} , '%')
|
||||
</if>
|
||||
/*企业统一社会信用代码*/
|
||||
<if test="shipperEnterpriseSocialCreditCode != null and shipperEnterpriseSocialCreditCode != ''">
|
||||
and b.shipper_enterprise_social_credit_code like concat('%' , #{shipperEnterpriseSocialCreditCode} , '%')
|
||||
</if>
|
||||
/*企业营业期限*/
|
||||
<if test="shipperEnterpriseLicenseDateFrom!=null and shipperEnterpriseLicenseDateTo!=null ">
|
||||
and DATE_FORMAT(b.shipper_enterprise_license_date_to,'%Y-%m-%d') <![CDATA[>=]]>
|
||||
DATE_FORMAT(#{shipperEnterpriseLicenseDateFrom},'%Y-%m-%d')
|
||||
and DATE_FORMAT(b.shipper_enterprise_license_date_to,'%Y-%m-%d') <![CDATA[<=]]>
|
||||
DATE_FORMAT(#{shipperEnterpriseLicenseDateTo},'%Y-%m-%d')
|
||||
</if>
|
||||
/*添加人员*/
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and b.create_by = #{createBy}
|
||||
</if>
|
||||
/* 组织ID集合 */
|
||||
<if test="permissionOrganizationIds!=null and permissionOrganizationIds.size > 0">
|
||||
AND a.organization_id IN
|
||||
<foreach collection="permissionOrganizationIds" item="organizationId" index="index" open="(" separator=" , "
|
||||
close=")">
|
||||
#{organizationId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="createBy != null and organizationIdList == null">
|
||||
and a.create_by = #{createBy}</if>
|
||||
<if test="organizationIdList != null and createBy == null">
|
||||
AND a.organization_id in
|
||||
<foreach item="id" collection="organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="organizationIdList != null and createBy != null">
|
||||
AND (a.organization_id in
|
||||
<foreach item="id" collection="organizationIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
OR a.create_by = #{createBy})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getShipperCountByMatter" parameterType="com.mhd.common.core.domain.todo.StatisticalMattersDo"
|
||||
resultType = "java.lang.Integer">
|
||||
select
|
||||
sum(case when us.shipper_fill = 2 then 1 end)
|
||||
+
|
||||
sum(case when us.shipper_enterprise_fill = 2 then 1 end) as `count`
|
||||
from user u
|
||||
left join user_shipper us on u.user_id = us.user_id
|
||||
<where>
|
||||
u.del_flag = 1
|
||||
and us.del_flag = 1
|
||||
<if test="statisticalMattersDo.organizationId != null and statisticalMattersDo.organizationId != ''">
|
||||
and u.organization_id = #{statisticalMattersDo.organizationId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getChooseShipper" resultType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity" parameterType="java.util.List">
|
||||
select
|
||||
*
|
||||
from user_shipper
|
||||
where del_flag = 1
|
||||
AND user_id in
|
||||
<foreach item="userId" collection="userIdList" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectBySealId" resultType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity" parameterType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity">
|
||||
select
|
||||
*
|
||||
from user_shipper
|
||||
where del_flag = 1
|
||||
and esign_seal_auth_id = #{userShipperEntity.esignSealAuthId}
|
||||
and esign_enterprise_status = #{userShipperEntity.esignEnterpriseStatus}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user