bt-yjj-system-examination-s.../src/main/resources/mybatis/mapper/stationuser/station-user-mapper.xml
2021-06-01 19:17:13 +08:00

352 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="cn.com.tenlion.dao.examination.stationuser.IStationUserDao">
<resultMap id="stationUserDTO" type="cn.com.tenlion.pojo.dtos.stationuser.StationUserDTO">
<result column="station_user_id" property="stationUserId"/>
<result column="station_id" property="stationId"/>
<result column="station_user_user_id" property="stationUserUserId"/>
<result column="station_user_user_name" property="stationUserUserName"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="stationUserBO" type="cn.com.tenlion.pojo.bos.stationuser.StationUserBO">
<result column="station_user_id" property="stationUserId"/>
<result column="station_id" property="stationId"/>
<result column="station_user_user_id" property="stationUserUserId"/>
<result column="station_user_user_name" property="stationUserUserName"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="stationUserPO" type="cn.com.tenlion.pojo.pos.stationuser.StationUserPO">
<result column="station_user_id" property="stationUserId"/>
<result column="station_id" property="stationId"/>
<result column="station_user_user_id" property="stationUserUserId"/>
<result column="station_user_user_name" property="stationUserUserName"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO e_station_user(
station_user_id,
station_id,
station_user_user_id,
station_user_user_name,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{stationUserId},
#{stationId},
#{stationUserUserId},
#{stationUserUserName},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除 -->
<update id="remove" parameterType="map">
UPDATE
e_station_user
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
station_user_id IN
<foreach collection="stationUserIds" index="index" open="(" separator="," close=")">
#{stationUserIds[${index}]}
</foreach>
</update>
<update id="deleteByStationId" parameterType="map">
DELETE FROM
e_station_user
WHERE
station_id = #{stationId}
</update>
<select id="getStationByUserIdAndStationId" parameterType="map" resultType="java.lang.String">
SELECT
t1.station_user_id
FROM
e_station_user t1
WHERE
t1.is_delete = 0 AND t1.station_id = #{stationId} AND t1.station_user_user_id = #{stationUserUserId}
</select>
<select id="getStationByUserId" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
t1.station_id
FROM
e_station_user t1
WHERE
t1.is_delete = 0 AND t1.station_user_user_id = #{stationUserUserId}
GROUP BY
t1.station_id
</select>
<select id="listByStationId" parameterType="map" resultMap="stationUserDTO">
SELECT
t1.station_user_id,
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_station_user t1
WHERE
t1.is_delete = 0 AND t1.station_id = #{stationId}
</select>
<!-- 删除(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
e_station_user
WHERE
station_user_id IN
<foreach collection="stationUserIds" index="index" open="(" separator="," close=")">
#{stationUserIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
e_station_user
SET
<if test="stationId != null and stationId != ''">
station_id = #{stationId},
</if>
<if test="stationUserUserId != null and stationUserUserId != ''">
station_user_user_id = #{stationUserUserId},
</if>
<if test="stationUserUserName != null and stationUserUserName != ''">
station_user_user_name = #{stationUserUserName},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
station_user_id = station_user_id
WHERE
station_user_id = #{stationUserId}
</update>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="stationUserDTO">
SELECT
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.station_user_id
FROM
e_station_user t1
WHERE
t1.is_delete = 0
<if test="stationUserId != null and stationUserId != ''">
AND
t1.station_user_id = #{stationUserId}
</if>
</select>
<!-- 详情 -->
<select id="getBO" parameterType="map" resultMap="stationUserBO">
SELECT
t1.station_user_id,
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_station_user t1
WHERE
t1.is_delete = 0
<if test="stationUserId != null and stationUserId != ''">
AND
t1.station_user_id = #{stationUserId}
</if>
</select>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="stationUserPO">
SELECT
t1.station_user_id,
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_station_user t1
WHERE
t1.is_delete = 0
<if test="stationUserId != null and stationUserId != ''">
AND
t1.station_user_id = #{stationUserId}
</if>
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="stationUserDTO">
SELECT
t1.station_user_id,
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
1
FROM
e_station_user t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="stationUserUserId != null and stationUserUserId != ''">
AND t1.station_user_user_id = #{stationUserUserId}
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="stationUserIds != null and stationUserIds.size > 0">
AND
t1.station_user_id IN
<foreach collection="stationUserIds" index="index" open="(" separator="," close=")">
#{stationUserIds[${index}]}
</foreach>
</if>
<if test="stationId != null and stationId != '' ">
AND t1.station_id = #{stationId}
</if>
</select>
<!-- 列表 -->
<select id="listBO" parameterType="map" resultMap="stationUserBO">
SELECT
t1.station_user_id,
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_station_user t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="stationUserIds != null and stationUserIds.size > 0">
AND
t1.station_user_id IN
<foreach collection="stationUserIds" index="index" open="(" separator="," close=")">
#{stationUserIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="stationUserPO">
SELECT
t1.station_user_id,
t1.station_id,
t1.station_user_user_id,
t1.station_user_user_name,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_station_user t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="stationUserIds != null and stationUserIds.size > 0">
AND
t1.station_user_id IN
<foreach collection="stationUserIds" index="index" open="(" separator="," close=")">
#{stationUserIds[${index}]}
</foreach>
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
e_station_user t1
WHERE
t1.is_delete = 0
</select>
</mapper>