<?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.sportsign.dao.SportSignDao">
|
|
<sql id="sportSignColumns">
|
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 "signCardID",
|
a.sign_entertime AS "signEnterTime",
|
a.sign_outtime AS "signOutTime",
|
a.transferid AS "TransferId",
|
a.schoolid AS "schoolId",
|
a.accesskey AS "accessKey",
|
a.locationid AS "locationId",
|
a.sign_other AS "signOther",
|
a.timecount AS "timeCount"
|
</sql>
|
|
<sql id="sportSignJoins">
|
</sql>
|
|
<select id="get" resultType="SportSign">
|
SELECT
|
<include refid="sportSignColumns"/>
|
FROM sport_sign a
|
<include refid="sportSignJoins"/>
|
WHERE a.id = #{id}
|
</select>
|
|
<select id="findList" resultType="SportSign">
|
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 "signCardID",
|
a.sign_entertime AS "signEnterTime",
|
a.sign_outtime AS "signOutTime",
|
a.transferid AS "TransferId",
|
a.schoolid AS "schoolId",
|
a.accesskey AS "accessKey",
|
a.locationid AS "locationId",
|
a.sign_other AS "signOther",
|
a.timecount AS "timeCount",
|
|
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"
|
|
FROM sport_sign a
|
left JOIN user_register u ON u.card_id = a.sign_card_id
|
|
WHERE 1=1
|
<if test="signCardID != null and signCardID != ''">
|
AND sign_card_id like CONCAT('%', #{signCardID}, '%')
|
|
</if>
|
<if test="signEnterTime != null and signEnterTime != ''">
|
<![CDATA[AND sign_entertime >= CONCAT(DATE_FORMAT(#{signEnterTime}, '%Y-%m-%d'),' 00:00:00')]]>
|
|
</if>
|
<if test="signOutTime!= null and signOutTime!= ''">
|
<![CDATA[AND sign_outtime <= CONCAT(DATE_FORMAT(#{signOutTime}, '%Y-%m-%d'),' 23:59:59')]]>
|
|
</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.timeCount DESC
|
</select>
|
|
<select id="findAllList" resultType="SportSign">
|
SELECT
|
<include refid="sportSignColumns"/>
|
FROM sport_sign a
|
<include refid="sportSignJoins"/>
|
<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 sport_sign(
|
id,
|
create_by,
|
create_date,
|
update_by,
|
update_date,
|
remarks,
|
del_flag,
|
sign_card_id,
|
sign_entertime,
|
sign_outtime,
|
transferid,
|
schoolid,
|
accesskey,
|
locationid,
|
sign_other,
|
timecount
|
) VALUES (
|
#{id},
|
#{createBy.id},
|
#{createDate},
|
#{updateBy.id},
|
#{updateDate},
|
#{remarks},
|
#{delFlag},
|
#{signCardID},
|
#{signEnterTime},
|
#{signOutTime},
|
#{TransferId},
|
#{schoolId},
|
#{accessKey},
|
#{locationId},
|
#{signOther},
|
#{timeCount}
|
)
|
</insert>
|
|
<update id="update">
|
UPDATE sport_sign SET
|
update_by = #{updateBy.id},
|
update_date = #{updateDate},
|
remarks = #{remarks},
|
sign_card_id = #{signCardID},
|
sign_entertime = #{signEnterTime},
|
sign_outtime = #{signOutTime},
|
transferid = #{TransferId},
|
schoolid = #{schoolId},
|
accesskey = #{accessKey},
|
locationid = #{locationId},
|
sign_other = #{signOther},
|
timecount = #{timeCount}
|
WHERE id = #{id}
|
</update>
|
|
|
<!--物理删除-->
|
<update id="delete">
|
DELETE FROM sport_sign
|
WHERE id = #{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deleteByLogic">
|
UPDATE sport_sign SET
|
del_flag = #{DEL_FLAG_DELETE}
|
WHERE id = #{id}
|
</update>
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
<select id="findUniqueByProperty" resultType="SportSign" statementType="STATEMENT">
|
select * FROM sport_sign where ${propertyName} = '${value}'
|
</select>
|
</mapper>
|