<?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.userregister.dao.UserRegisterDao">
|
|
<sql id="userRegisterColumns">
|
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.user_id AS "userId",
|
a.card_id AS "cardId",
|
a.user_name AS "userName",
|
a.dep_id AS "depId",
|
a.user_sex AS "usersex",
|
a.user_type AS "userType",
|
a.user_status AS "userStatus",
|
a.user_duty AS "userDuty",
|
a.user_other AS "userOther",
|
a.user_class AS "userClass",
|
a.user_birthday AS "userBirthday"
|
</sql>
|
|
<sql id="userRegisterJoins">
|
</sql>
|
|
<select id="get" resultType="UserRegister">
|
SELECT
|
<include refid="userRegisterColumns"/>
|
FROM user_register a
|
<include refid="userRegisterJoins"/>
|
WHERE a.id = #{id}
|
</select>
|
|
<select id="findList" resultType="UserRegister">
|
SELECT
|
<include refid="userRegisterColumns"/>
|
FROM user_register a
|
<include refid="userRegisterJoins"/>
|
<where>
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
<if test="userId != null and userId != ''">
|
AND a.user_id = #{userId}
|
</if>
|
<if test="cardId != null and cardId != ''">
|
AND a.card_id = #{cardId}
|
</if>
|
<if test="userName != null and userName != ''">
|
AND a.user_name = #{userName}
|
</if>
|
<if test="depId != null and depId != ''">
|
AND a.dep_id = #{depId}
|
</if>
|
<if test="usersex != null and usersex != ''">
|
AND a.user_sex = #{usersex}
|
</if>
|
<if test="userType != null and userType != ''">
|
AND a.user_type = #{userType}
|
</if>
|
<if test="userStatus != null and userStatus != ''">
|
AND a.user_status = #{userStatus}
|
</if>
|
<if test="userDuty != null and userDuty != ''">
|
AND a.user_duty = #{userDuty}
|
</if>
|
<if test="userClass != null and userClass != ''">
|
AND a.user_class = #{userClass}
|
</if>
|
<if test="userBirthday != null and userBirthday != ''">
|
AND a.user_birthday = #{userBirthday}
|
</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="UserRegister">
|
SELECT
|
<include refid="userRegisterColumns"/>
|
FROM user_register a
|
<include refid="userRegisterJoins"/>
|
<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 user_register(
|
id,
|
create_by,
|
create_date,
|
update_by,
|
update_date,
|
remarks,
|
del_flag,
|
user_id,
|
card_id,
|
user_name,
|
dep_id,
|
user_sex,
|
user_type,
|
user_status,
|
user_duty,
|
user_other,
|
user_class,
|
user_birthday
|
) VALUES (
|
#{id},
|
#{createBy.id},
|
#{createDate},
|
#{updateBy.id},
|
#{updateDate},
|
#{remarks},
|
#{delFlag},
|
#{userId},
|
#{cardId},
|
#{userName},
|
#{depId},
|
#{usersex},
|
#{userType},
|
#{userStatus},
|
#{userDuty},
|
#{userOther},
|
#{userClass},
|
#{userBirthday}
|
)
|
</insert>
|
|
<update id="update">
|
UPDATE user_register SET
|
update_by = #{updateBy.id},
|
update_date = #{updateDate},
|
remarks = #{remarks},
|
user_id = #{userId},
|
card_id = #{cardId},
|
user_name = #{userName},
|
dep_id = #{depId},
|
user_sex = #{usersex},
|
user_type = #{userType},
|
user_status = #{userStatus},
|
user_duty = #{userDuty},
|
user_other = #{userOther},
|
user_birthday = #{userBirthday},
|
user_class = #{userClass}
|
WHERE id = #{id}
|
</update>
|
|
|
<!--物理删除-->
|
<update id="delete">
|
DELETE FROM user_register
|
WHERE id = #{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deleteByLogic">
|
UPDATE user_register SET
|
del_flag = #{DEL_FLAG_DELETE}
|
WHERE id = #{id}
|
</update>
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
<select id="findUniqueByProperty" resultType="UserRegister" statementType="STATEMENT">
|
select * FROM user_register where ${propertyName} = '${value}'
|
</select>
|
</mapper>
|