<?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.sporttotal.dao.SportTotalDao">
|
|
<sql id="sportTotalColumns">
|
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.card_id AS "CardID",
|
a.sport_time_total AS "sportTimeTotal",
|
a.sport_order AS "sportOrder",
|
a.sport_count AS "sportCount",
|
a.other_1 AS "Other1",
|
a.other_2 AS "Other2",
|
a.other_3 AS "Other3"
|
</sql>
|
|
<sql id="sportTotalJoins">
|
</sql>
|
|
<select id="get" resultType="SportTotal">
|
SELECT
|
<include refid="sportTotalColumns"/>
|
FROM sporttotal a
|
<include refid="sportTotalJoins"/>
|
WHERE a.id = #{id}
|
</select>
|
|
<select id="findList" resultType="SportTotal">
|
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.timecount AS "timeCount",
|
a.sporttotal AS "sportTotal",
|
a.sporttimes AS "sportTimes",
|
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 sporttotalv 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>
|
<choose>
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
ORDER BY ${page.orderBy}
|
</when>
|
<otherwise>
|
ORDER BY a.sportTotal DESC
|
</otherwise>
|
</choose>
|
|
</select>
|
|
<select id="findAllList" resultType="SportTotal">
|
SELECT
|
<include refid="sportTotalColumns"/>
|
FROM sporttotal a
|
<include refid="sportTotalJoins"/>
|
<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 sporttotal(
|
id,
|
create_by,
|
create_date,
|
update_by,
|
update_date,
|
remarks,
|
del_flag,
|
card_id,
|
sport_time_total,
|
sport_order,
|
sport_count,
|
other_1,
|
other_2,
|
other_3
|
) VALUES (
|
#{id},
|
#{createBy.id},
|
#{createDate},
|
#{updateBy.id},
|
#{updateDate},
|
#{remarks},
|
#{delFlag},
|
#{CardID},
|
#{sportTimeTotal},
|
#{sportOrder},
|
#{sportCount},
|
#{Other1},
|
#{Other2},
|
#{Other3}
|
)
|
</insert>
|
|
<update id="update">
|
UPDATE sporttotal SET
|
update_by = #{updateBy.id},
|
update_date = #{updateDate},
|
remarks = #{remarks},
|
card_id = #{CardID},
|
sport_time_total = #{sportTimeTotal},
|
sport_order = #{sportOrder},
|
sport_count = #{sportCount},
|
other_1 = #{Other1},
|
other_2 = #{Other2},
|
other_3 = #{Other3}
|
WHERE id = #{id}
|
</update>
|
|
|
<!--物理删除-->
|
<update id="delete">
|
DELETE FROM sporttotal
|
WHERE id = #{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deleteByLogic">
|
UPDATE sporttotal SET
|
del_flag = #{DEL_FLAG_DELETE}
|
WHERE id = #{id}
|
</update>
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
<select id="findUniqueByProperty" resultType="SportTotal" statementType="STATEMENT">
|
select * FROM sporttotal where ${propertyName} = '${value}'
|
</select>
|
</mapper>
|