forked from integrated_whb/integrated_whb
413 lines
11 KiB
XML
413 lines
11 KiB
XML
<?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.zcloud.mapper.datasource.scrapManage.ScrapManageMapper">
|
|
|
|
<!--表名 -->
|
|
<sql id="tableName">
|
|
BUS_TRAFFIC_SCRAP_MANAGEMENT
|
|
</sql>
|
|
|
|
<!--数据字典表名 -->
|
|
<sql id="dicTableName">
|
|
SYS_DICTIONARIES
|
|
</sql>
|
|
|
|
<!-- 字段 -->
|
|
<sql id="Field">
|
|
f.SCRAP_ID,
|
|
f.RECORD_NUMBER,
|
|
f.PLATE_NUMBER,
|
|
f.SCRAP_VEHICLEMODEL,
|
|
f.VEHICLEOWNER,
|
|
f.CONTACT_NUMBER,
|
|
f.SCRAP_DATE,
|
|
f.REGISTRANT,
|
|
f.CORPINFO_ID,
|
|
f.TRANSPORT_ENTERPRISES,
|
|
f.SCRAP_VEHICLE,
|
|
f.VEHICLEOWNER_NUMBER,
|
|
f.DRIVINGLICENSE_PHOTO,
|
|
f.FRAMES_NUMBER,
|
|
f.BRAND,
|
|
f.EMISSION_STANDARD,
|
|
f.POWER_TYPE,
|
|
f.FIRSTSHOW_DATE,
|
|
f.SCRAP_MATERIAL,
|
|
f.REMARK,
|
|
f.ENGINE_NUMBER,
|
|
f.VEHICLE_MODEL,
|
|
f.TRANSACTION_DATE,
|
|
f.ISDELETE,
|
|
f.CREATOR,
|
|
f.CREATORNAME,
|
|
f.CREATTIME,
|
|
f.OPERATOR,
|
|
f.OPERATORNAME,
|
|
f.OPERATTIME,
|
|
f.DELETOR,
|
|
f.DELETORNAME,
|
|
f.DELETTIME
|
|
</sql>
|
|
|
|
<!-- 字段用于新增 -->
|
|
<sql id="Field2">
|
|
SCRAP_ID,
|
|
RECORD_NUMBER,
|
|
PLATE_NUMBER,
|
|
SCRAP_VEHICLEMODEL,
|
|
VEHICLEOWNER,
|
|
CONTACT_NUMBER,
|
|
SCRAP_DATE,
|
|
REGISTRANT,
|
|
CORPINFO_ID,
|
|
TRANSPORT_ENTERPRISES,
|
|
SCRAP_VEHICLE,
|
|
VEHICLEOWNER_NUMBER,
|
|
DRIVINGLICENSE_PHOTO,
|
|
FRAMES_NUMBER,
|
|
BRAND,
|
|
EMISSION_STANDARD,
|
|
POWER_TYPE,
|
|
FIRSTSHOW_DATE,
|
|
SCRAP_MATERIAL,
|
|
REMARK,
|
|
ENGINE_NUMBER,
|
|
VEHICLE_MODEL,
|
|
TRANSACTION_DATE,
|
|
ISDELETE,
|
|
CREATOR,
|
|
CREATORNAME,
|
|
CREATTIME,
|
|
OPERATOR,
|
|
OPERATORNAME,
|
|
OPERATTIME,
|
|
DELETOR,
|
|
DELETORNAME,
|
|
DELETTIME
|
|
</sql>
|
|
|
|
<!-- 字段值 -->
|
|
<sql id="FieldValue">
|
|
#{SCRAP_ID},
|
|
#{RECORD_NUMBER},
|
|
#{PLATE_NUMBER},
|
|
#{SCRAP_VEHICLEMODEL},
|
|
#{VEHICLEOWNER},
|
|
#{CONTACT_NUMBER},
|
|
#{SCRAP_DATE},
|
|
#{REGISTRANT},
|
|
#{CORPINFO_ID},
|
|
#{TRANSPORT_ENTERPRISES},
|
|
#{SCRAP_VEHICLE},
|
|
#{VEHICLEOWNER_NUMBER},
|
|
#{DRIVINGLICENSE_PHOTO},
|
|
#{FRAMES_NUMBER},
|
|
#{BRAND},
|
|
#{EMISSION_STANDARD},
|
|
#{POWER_TYPE},
|
|
#{FIRSTSHOW_DATE},
|
|
#{SCRAP_MATERIAL},
|
|
#{REMARK},
|
|
#{ENGINE_NUMBER},
|
|
#{VEHICLE_MODEL},
|
|
#{TRANSACTION_DAT},
|
|
#{ISDELETE},
|
|
#{CREATOR},
|
|
#{CREATORNAME},
|
|
#{CREATTIME},
|
|
#{OPERATOR},
|
|
#{OPERATORNAME},
|
|
#{OPERATTIME},
|
|
#{DELETOR},
|
|
#{DELETORNAME},
|
|
#{DELETTIME}
|
|
</sql>
|
|
|
|
<!-- 新增-->
|
|
<insert id="save" parameterType="pd">
|
|
insert into
|
|
<include refid="tableName"></include>
|
|
(
|
|
<include refid="Field2"></include>
|
|
) values (
|
|
<include refid="FieldValue"></include>
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除-->
|
|
<delete id="delete" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
ISDELETE = '1'
|
|
where
|
|
SCRAP_ID = #{SCRAP_ID}
|
|
</delete>
|
|
|
|
<!-- 修改 -->
|
|
<update id="edit" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
SCRAP_ID = #{SCRAP_ID},
|
|
RECORD_NUMBER = #{RECORD_NUMBER},
|
|
PLATE_NUMBER = #{PLATE_NUMBER},
|
|
SCRAP_VEHICLEMODEL = #{SCRAP_VEHICLEMODEL},
|
|
VEHICLEOWNER = #{VEHICLEOWNER},
|
|
CONTACT_NUMBER = #{CONTACT_NUMBER},
|
|
SCRAP_DATE = #{SCRAP_DATE},
|
|
REGISTRANT = #{REGISTRANT},
|
|
CORPINFO_ID = #{CORPINFO_ID},
|
|
TRANSPORT_ENTERPRISES = #{TRANSPORT_ENTERPRISES},
|
|
SCRAP_VEHICLE = #{SCRAP_VEHICLE},
|
|
VEHICLEOWNER_NUMBER = #{VEHICLEOWNER_NUMBER},
|
|
DRIVINGLICENSE_PHOTO = #{DRIVINGLICENSE_PHOTO},
|
|
FRAMES_NUMBER = #{FRAMES_NUMBER},
|
|
BRAND = #{BRAND},
|
|
EMISSION_STANDARD = #{EMISSION_STANDARD},
|
|
POWER_TYPE = #{POWER_TYPE},
|
|
FIRSTSHOW_DATE = #{FIRSTSHOW_DATE},
|
|
SCRAP_MATERIAL = #{SCRAP_MATERIAL},
|
|
REMARK = #{REMARK},
|
|
ENGINE_NUMBER = #{ENGINE_NUMBER},
|
|
VEHICLE_MODEL = #{VEHICLE_MODEL},
|
|
TRANSACTION_DATE = #{TRANSACTION_DATE},
|
|
ISDELETE = #{ISDELETE},
|
|
CREATOR = #{CREATOR},
|
|
CREATORNAME = #{CREATORNAME},
|
|
CREATTIME = #{CREATTIME},
|
|
OPERATOR = #{OPERATOR},
|
|
OPERATORNAME = #{OPERATORNAME},
|
|
OPERATTIME = #{OPERATTIME},
|
|
DELETOR = #{DELETOR},
|
|
DELETORNAME = #{DELETORNAME},
|
|
DELETTIME =#{DELETTIME},
|
|
where
|
|
SCRAP_ID = #{SCRAP_ID}
|
|
</update>
|
|
|
|
<!-- 通过ID获取数据 -->
|
|
<select id="findById" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include> f
|
|
where
|
|
f.SCRAP_ID = #{SCRAP_ID} and
|
|
f.ISDELETE = '0' AND
|
|
f.CORPINFO_ID = #{CORPINFO_ID}
|
|
</select>
|
|
|
|
<!-- 列表 -->
|
|
<!--<select id="datalistPage" parameterType="page" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include> f
|
|
left join sys_user u on u.USER_ID = f.USER_ID
|
|
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
|
left join sys_post p on p.POST_ID = u.POST_ID
|
|
left join sys_user ru on ru.USER_ID = f.REVIEW_USER_ID
|
|
left join oa_department rd on rd.DEPARTMENT_ID = ru.DEPARTMENT_ID
|
|
where (f.ISDELETE = '0' or (f.ISDELETE = '1' and f.REVIEW_STATUS = '-1'))
|
|
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!– 关键词检索 –>
|
|
and
|
|
(
|
|
u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
)
|
|
</if>
|
|
<if test="pd.REVIEW_STATUS != null and pd.REVIEW_STATUS != ''"><!– 关键词检索 –>
|
|
<choose>
|
|
<when test="pd.REVIEW_STATUS == 0">
|
|
and f.REVIEW_STATUS = '0'
|
|
</when>
|
|
<when test="pd.REVIEW_STATUS == 1">
|
|
and f.REVIEW_STATUS = '1'
|
|
</when>
|
|
<when test="pd.REVIEW_STATUS == 2">
|
|
and f.REVIEW_STATUS = '2'
|
|
</when>
|
|
<when test="pd.REVIEW_STATUS == -1">
|
|
and f.ISDELETE = '0' and f.REVIEW_STATUS = '-1'
|
|
</when>
|
|
<when test="pd.REVIEW_STATUS == 3">
|
|
and f.CREATOR = f.OPERATOR and f.ISDELETE = '1' and f.REVIEW_STATUS = '-1'
|
|
</when>
|
|
<when test="pd.REVIEW_STATUS == 4">
|
|
and f.CREATOR != f.OPERATOR and f.ISDELETE = '1' and f.REVIEW_STATUS = '-1'
|
|
</when>
|
|
</choose>
|
|
</if>
|
|
<if test="pd.REVIEW_USER_NAME != null and pd.REVIEW_USER_NAME != ''"><!– 关键词检索 –>
|
|
and ru.NAME LIKE CONCAT(CONCAT('%', #{pd.REVIEW_USER_NAME}),'%')
|
|
</if>
|
|
<if test="pd.DEPT_DOWN_ARR != null and pd.DEPT_DOWN_ARR.size() > 0">
|
|
AND d.DEPARTMENT_ID IN
|
|
<foreach item="item" collection="pd.DEPT_DOWN_ARR" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</if>
|
|
<!– <if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">关键词检索
|
|
and d.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
</if>
|
|
–>
|
|
|
|
<choose>
|
|
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
|
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</if>
|
|
</when>
|
|
<otherwise>
|
|
<choose>
|
|
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
|
<choose>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
((d.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
)) or (
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
))
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
or f.REVIEW_USER_ID = #{pd.USER_ID}
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
|
|
and
|
|
d.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID})
|
|
or f.REVIEW_USER_ID = #{pd.USER_ID}
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
and d.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
|
and f.REVIEW_USER_ID = #{pd.USER_ID}
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</otherwise>
|
|
</choose>
|
|
<choose>
|
|
<when test="pd.STARTTIME != null and pd.STARTTIME != '' and pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
and DATE_FORMAT(#{pd.STARTTIME},'%Y-%m-%d %H:%i:%s') <= DATE_FORMAT(f.STARTTIME,'%Y-%m-%d %H:%i:%s')
|
|
and DATE_FORMAT(#{pd.ENDTIME},'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(f.ENDTIME,'%Y-%m-%d %H:%i:%s')
|
|
</when>
|
|
<otherwise>
|
|
<if test="pd.STARTTIME != null and pd.STARTTIME != ''">
|
|
and DATE_FORMAT(#{pd.STARTTIME},'%Y-%m-%d %H:%i:%s') <= DATE_FORMAT(f.ENDTIME,'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
<if test="pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
and DATE_FORMAT(#{pd.ENDTIME},'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(f.STARTTIME,'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</otherwise>
|
|
</choose>
|
|
order by f.OPERATTIME desc
|
|
</select>-->
|
|
|
|
<!-- 列表(全部) -->
|
|
<select id="datalistPage" parameterType="page" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include> f
|
|
where f.ISDELETE = '0'
|
|
<if test="pd.SCRAP_VEHICLEMODEL != null and pd.SCRAP_VEHICLEMODEL != ''"><!-- 关键词检索 -->
|
|
and f.SCRAP_VEHICLEMODEL = #{pd.SCRAP_VEHICLEMODEL}
|
|
</if>
|
|
<if test="pd.PLATE_NUMBER != null and pd.PLATE_NUMBER != ''"><!-- 关键词检索 -->
|
|
and f.PLATE_NUMBER LIKE CONCAT(CONCAT('%', #{pd.PLATE_NUMBER}),'%')
|
|
</if>
|
|
<if test="pd.VEHICLEOWNER != null and pd.VEHICLEOWNER != ''"><!-- 关键词检索 -->
|
|
and f.VEHICLEOWNER LIKE CONCAT(CONCAT('%', #{pd.VEHICLEOWNER}),'%')
|
|
</if>
|
|
<if test="pd.REGISTRANT != null and pd.REGISTRANT != ''"><!-- 关键词检索 -->
|
|
and f.REGISTRANT LIKE CONCAT(CONCAT('%', #{pd.REGISTRANT}),'%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="scrapListAll" parameterType="page" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include> f
|
|
where f.ISDELETE = '0'
|
|
AND f.CORPINFO_ID = #{corpId}
|
|
</select>
|
|
|
|
<select id="listAll" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include> f
|
|
where f.SCRAP_ID = '0'
|
|
</select>
|
|
|
|
|
|
</mapper>
|