<?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.jeeplus.modules.sign.dao.FormSignDao">
|
|
<sql id="formSignColumns">
|
a.id AS "id",
|
a.create_by AS "createBy.id",
|
a.create_date AS "createDate",
|
a.update_by AS "updateBy.id",
|
a.update_date AS "updateDate",
|
a.remarks AS "remarks",
|
a.del_flag AS "delFlag",
|
a.sign_card_id AS "signUserID",
|
a.sign_time AS "signTime",
|
a.sign_status AS "signStatus",
|
a.sign_type AS "signType",
|
a.location_id AS "locationId",
|
a.sign_other AS "signOther",
|
a.transferId AS "transferId",
|
a.schoolId AS "schoolId",
|
a.accessKey AS "accessKey"
|
</sql>
|
|
<sql id="formSignJoins">
|
</sql>
|
|
<select id="get" resultType="FormSign">
|
SELECT
|
<include refid="formSignColumns"/>
|
FROM form_sign a
|
<include refid="formSignJoins"/>
|
WHERE a.id = #{id}
|
</select>
|
<select id="findList" resultType="FormSign">
|
<if test="signType != null and signType == 1">
|
|
|
SELECT
|
a.id AS "id",
|
a.create_by AS "createBy.id",
|
a.create_date AS "createDate",
|
a.update_by AS "updateBy.id",
|
a.update_date AS "updateDate",
|
a.remarks AS "remarks",
|
a.del_flag AS "delFlag",
|
a.sign_card_id AS "signUserID",
|
a.sign_time AS "signTime",
|
a.sign_status AS "signStatus",
|
a.sign_type AS "signType",
|
a.location_id AS "locationId",
|
a.sign_other AS "signOther",
|
|
u.user_id AS "userId",
|
u.card_id AS "cardId",
|
u.user_name AS "userName",
|
u.dep_id AS "depId",
|
u.user_sex AS "usersex",
|
u.user_type AS "userType",
|
u.user_status AS "userStatus",
|
u.user_duty AS "userDuty",
|
u.user_other AS "userOther",
|
a.transferId AS "transferId",
|
a.schoolId AS "schoolId",
|
a.accessKey AS "accessKey"
|
FROM form_sign a
|
right JOIN user_register u ON u.card_id = a.sign_card_id
|
|
WHERE 1=1
|
<if test="signTime != null and signTime != ''">
|
|
<if test="signTimeRang == 0">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 00:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 23:59:59') ]]>
|
|
</if>
|
<!-- 上午 -->
|
<if test="signTimeRang == 1">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 00:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 12:00:00') ]]>
|
</if>
|
<!-- 下午 -->
|
<if test="signTimeRang == 2">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 12:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 23:59:59') ]]>
|
</if>
|
</if>
|
|
<if test="signTime =='' ">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(curdate(), '%Y-%m-%d'),' 00:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(curdate(), '%Y-%m-%d'),' 23:59:59') ]]>
|
</if>
|
<if test="signUserID != null and signUserID != ''">
|
AND sign_card_id like CONCAT('%', #{signUserID}, '%')
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
AND user_name like CONCAT('%', #{userName}, '%')
|
|
</if>
|
|
|
<if test="UserDepIDList!= null ">
|
|
<foreach collection="UserDepIDList" index="index" item="tag" open=" and u.dep_id in ("
|
separator="," close=")">
|
|
#{tag}
|
|
</foreach>
|
|
|
</if>
|
ORDER BY a.sign_time DESC
|
</if>
|
<if test="signType != null and signType == 2">
|
SELECT u.user_id AS "userId",
|
u.card_id AS "signUserID",
|
u.user_name AS "userName",
|
u.dep_id AS "depId",
|
u.user_sex AS "usersex",
|
u.user_type AS "userType",
|
u.user_status AS "userStatus",
|
u.user_duty AS "userDuty",
|
u.user_other AS "userOther"
|
FROM user_register u WHERE 1=1 AND u.card_id not in (
|
|
SELECT sign_card_id FROM form_sign where 1=1
|
<if test="signTime != null and signTime != ''">
|
|
<if test="signTimeRang == 0">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 00:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 23:59:59') ]]>
|
|
</if>
|
<!-- 上午 -->
|
<if test="signTimeRang == 1">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 00:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 12:00:00') ]]>
|
</if>
|
<!-- 下午 -->
|
<if test="signTimeRang == 2">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 12:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(#{signTime}, '%Y-%m-%d'),' 23:59:59') ]]>
|
</if>
|
</if>
|
|
<if test="signTime =='' ">
|
<![CDATA[ and sign_time >= CONCAT(DATE_FORMAT(curdate(), '%Y-%m-%d'),' 00:00:00') ]]>
|
<![CDATA[ and sign_time <= CONCAT(DATE_FORMAT(curdate(), '%Y-%m-%d'),' 23:59:59') ]]>
|
</if>
|
<if test="signUserID != null and signUserID != ''">
|
AND sign_card_id like CONCAT('%', #{signUserID}, '%')
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
AND user_name like CONCAT('%', #{userName}, '%')
|
|
</if>
|
|
|
<if test="UserDepIDList!= null ">
|
|
<foreach collection="UserDepIDList" index="index" item="tag" open=" and u.dep_id in ("
|
separator="," close=")">
|
|
#{tag}
|
|
</foreach>
|
|
|
</if>
|
|
)
|
</if>
|
</select>
|
<select id="findList1111" resultType="FormSign">
|
SELECT
|
<include refid="formSignColumns"/>
|
FROM form_sign a
|
<include refid="formSignJoins"/>
|
<where>
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
<if test="signUserID != null and signUserID != ''">
|
AND a.sign_card_id = #{signUserID}
|
</if>
|
<if test="signTime != null and signTime != ''">
|
AND a.sign_time = #{signTime}
|
</if>
|
<if test="signStatus != null and signStatus != ''">
|
AND a.sign_status = #{signStatus}
|
</if>
|
<if test="signType != null and signType != ''">
|
AND a.sign_type = #{signType}
|
</if>
|
<if test="locationId != null and locationId != ''">
|
AND a.location_id = #{locationId}
|
</if>
|
<if test="signOther != null and signOther != ''">
|
AND a.sign_other = #{signOther}
|
</if>
|
<if test="suserother != null and suserother != ''">
|
AND a.transferId= #{transferId}
|
</if>
|
<if test="suserother != null and suserother != ''">
|
AND a.schoolId = #{schoolId}
|
</if>
|
<if test="suserother != null and suserother != ''">
|
AND a.accessKey = #{accessKey}
|
</if>
|
</where>
|
<choose>
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
ORDER BY ${page.orderBy}
|
</when>
|
<otherwise>
|
ORDER BY a.update_date DESC
|
</otherwise>
|
</choose>
|
</select>
|
|
<select id="findAllList" resultType="FormSign">
|
SELECT
|
<include refid="formSignColumns"/>
|
FROM form_sign a
|
<include refid="formSignJoins"/>
|
<where>
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
</where>
|
<choose>
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
ORDER BY ${page.orderBy}
|
</when>
|
<otherwise>
|
ORDER BY a.update_date DESC
|
</otherwise>
|
</choose>
|
</select>
|
|
<insert id="insert">
|
INSERT INTO form_sign(
|
id,
|
create_by,
|
create_date,
|
update_by,
|
update_date,
|
remarks,
|
del_flag,
|
sign_card_id,
|
sign_time,
|
sign_status,
|
sign_type,
|
location_id,
|
sign_other,
|
transferId,
|
schoolId,
|
accessKey
|
) VALUES (
|
#{id},
|
#{createBy.id},
|
#{createDate},
|
#{updateBy.id},
|
#{updateDate},
|
#{remarks},
|
#{delFlag},
|
#{signUserID},
|
#{signTime},
|
#{signStatus},
|
#{signType},
|
#{locationId},
|
#{signOther},
|
#{transferId},
|
#{schoolId},
|
#{accessKey}
|
)
|
</insert>
|
|
<update id="update">
|
UPDATE form_sign SET
|
update_by = #{updateBy.id},
|
update_date = #{updateDate},
|
remarks = #{remarks},
|
sign_card_id = #{signUserID},
|
sign_time = #{signTime},
|
sign_status = #{signStatus},
|
sign_type = #{signType},
|
location_id = #{locationId},
|
sign_other = #{signOther},
|
transferId=#{transferId},
|
schoolId=#{schoolId},
|
accessKey=#{accessKey}
|
WHERE id = #{id}
|
</update>
|
|
|
<!--物理删除-->
|
<update id="delete">
|
DELETE FROM form_sign
|
WHERE id = #{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deleteByLogic">
|
UPDATE form_sign SET
|
del_flag = #{DEL_FLAG_DELETE}
|
WHERE id = #{id}
|
</update>
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
<select id="findUniqueByProperty" resultType="FormSign" statementType="STATEMENT">
|
select * FROM form_sign where ${propertyName} = '${value}'
|
</select>
|
</mapper>
|