| | |
| | | </update> |
| | | |
| | | |
| | | <select id="getAllUser" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user where deleted=0 |
| | | </select> |
| | | |
| | | <select id="getAllUser" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user where deleted=0 |
| | | </select> |
| | | |
| | | <select id="getUserByLevel" resultMap="BaseResultMap"> |
| | | select |
| | | id,real_name |
| | | from t_user where deleted=0 and user_level = #{userLevel} |
| | | </select> |
| | | <select id="getUserByLevel" resultMap="BaseResultMap"> |
| | | select id, |
| | | real_name |
| | | from t_user |
| | | where deleted = 0 |
| | | and user_level = #{userLevel} |
| | | </select> |
| | | |
| | | <select id="getUserById" resultMap="BaseResultMap"> |
| | | select |
| | |
| | | where id=#{value} and status = 1 and deleted = 0 |
| | | </select> |
| | | |
| | | <select id="getUserByUserName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and user_name=#{value} limit 1 |
| | | </select> |
| | | <select id="getUserByUserName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and user_name=#{value} limit 1 |
| | | </select> |
| | | |
| | | <select id="getUserByRealName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and real_name = #{realName} |
| | | </select> |
| | | <select id="getUserByRealName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and real_name = #{realName} |
| | | </select> |
| | | |
| | | <select id="getUserByUserNamePwd" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and user_name=#{username} and password=#{pwd} limit 1 |
| | | </select> |
| | | <select id="getUserByUserNamePwd" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and user_name=#{username} and password=#{pwd} limit 1 |
| | | </select> |
| | | |
| | | <select id="getUserByUuid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and user_uuid=#{value,jdbcType=VARCHAR} |
| | | </select> |
| | | <select id="getUserByUuid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and user_uuid=#{value,jdbcType=VARCHAR} |
| | | </select> |
| | | |
| | | |
| | | <select id="userPageList" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_user |
| | | <where> |
| | | and deleted=0 |
| | | <if test="name != null and name != ''"> |
| | | and real_name like concat('%',#{name},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY id |
| | | <if test="offset != null and limit != null "> |
| | | <bind name="patternAdd" value="limit*offset"/> |
| | | limit #{limit} OFFSET #{offset} |
| | | </if> |
| | | </select> |
| | | <select id="userPageList" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_user |
| | | <where> |
| | | and deleted=0 |
| | | <if test="name != null and name != ''"> |
| | | and real_name like concat('%',#{name},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY id |
| | | <if test="offset != null and limit != null "> |
| | | <bind name="patternAdd" value="limit*offset"/> |
| | | limit #{limit} OFFSET #{offset} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="userPageCount" resultType="java.lang.Integer"> |
| | | select count(*) from t_user |
| | | <where> |
| | | and deleted=0 |
| | | <if test="name != null and name != ''"> |
| | | and real_name like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="userPageCount" resultType="java.lang.Integer"> |
| | | select count(*) from t_user |
| | | <where> |
| | | and deleted=0 |
| | | <if test="name != null and name != ''"> |
| | | and real_name like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="userPage" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_user |
| | | <where> |
| | | and deleted=0 |
| | | <if test="userName != null and userName != ''"> |
| | | and real_name like concat('%',#{userName},'%') |
| | | </if> |
| | | <if test="role != null "> |
| | | and role= #{role} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="userPage" resultMap="BaseResultMap" |
| | | parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_user |
| | | <where> |
| | | and deleted=0 |
| | | <if test="userName != null and userName != ''"> |
| | | and real_name like concat('%',#{userName},'%') |
| | | </if> |
| | | <if test="role != null "> |
| | | and role= #{role} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertUser" parameterType="com.mindskip.xzs.domain.User" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_user |
| | | (user_uuid, user_name, password, real_name, age, last_active_time) |
| | | values (#{userUuid,jdbcType=VARCHAR}, #{userName}, #{password}, #{realName}, #{age}, #{lastActiveTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertUser" parameterType="com.mindskip.xzs.domain.User" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_user |
| | | (user_uuid,user_name,password,real_name,age, last_active_time) |
| | | values |
| | | (#{userUuid,jdbcType=VARCHAR},#{userName},#{password},#{realName},#{age},#{lastActiveTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertUsers" parameterType="java.util.List" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_user |
| | | (user_uuid,user_name,password,real_name,last_active_time,role,status,user_level,deleted) |
| | | values |
| | | <foreach collection="list" item="item" |
| | | separator=","> |
| | | (#{item.userUuid,jdbcType=VARCHAR},#{item.userName,jdbcType=VARCHAR},#{item.password,jdbcType=VARCHAR},#{item.realName,jdbcType=VARCHAR}, |
| | | #{item.lastActiveTime},#{item.role},#{item.status},#{item.userLevel},0) |
| | | </foreach> |
| | | </insert> |
| | | <insert id="insertUsers" parameterType="java.util.List" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_user |
| | | (user_uuid,user_name,password,real_name,last_active_time,role,status,user_level,deleted) |
| | | values |
| | | <foreach collection="list" item="item" |
| | | separator=","> |
| | | (#{item.userUuid,jdbcType=VARCHAR},#{item.userName,jdbcType=VARCHAR},#{item.password,jdbcType=VARCHAR},#{item.realName,jdbcType=VARCHAR}, |
| | | #{item.lastActiveTime},#{item.role},#{item.status},#{item.userLevel},0) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | |
| | | <update id="updateUser" parameterType="com.mindskip.xzs.domain.User"> |
| | | update t_user |
| | | <set> |
| | | <if test="realName != null">real_name = #{realName},</if> |
| | | <if test="age != null">age = #{age},</if> |
| | | <if test="lastActiveTime != null">last_active_time = #{lastActiveTime},</if> |
| | | </set> |
| | | where id = #{id} |
| | | </update> |
| | | <update id="updateUser" parameterType="com.mindskip.xzs.domain.User"> |
| | | update t_user |
| | | <set> |
| | | <if test="realName != null">real_name = #{realName},</if> |
| | | <if test="age != null">age = #{age},</if> |
| | | <if test="lastActiveTime != null">last_active_time = #{lastActiveTime},</if> |
| | | </set> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | |
| | | <update id="updateUsersAge"> |
| | | update t_user set age = #{age} where id in |
| | | <foreach item="id" collection="idslist" open="(" separator="," |
| | | close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </update> |
| | | <update id="updateUsersAge"> |
| | | update t_user set age = #{age} where id in |
| | | <foreach item="id" collection="idslist" open="(" separator="," |
| | | close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </update> |
| | | |
| | | |
| | | <delete id="deleteUsersByIds"> |
| | | delete from t_user where id in |
| | | <foreach item="id" collection="list" open="(" separator="," |
| | | close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | <delete id="deleteUsersByIds"> |
| | | delete from t_user where id in |
| | | <foreach item="id" collection="list" open="(" separator="," |
| | | close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectAllCount" resultType="java.lang.Integer"> |
| | | SELECT count(*) from t_user where deleted=0 |
| | | </select> |
| | | <select id="selectAllCount" resultType="java.lang.Integer"> |
| | | SELECT count(*) |
| | | from t_user |
| | | where deleted = 0 |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByUserName" resultType="com.mindskip.xzs.domain.other.KeyValue"> |
| | | SELECT id as value,user_name as name |
| | | from t_user |
| | | where deleted=0 and user_name like concat('%',#{value},'%') |
| | | limit 5 |
| | | </select> |
| | | <select id="selectByUserName" resultType="com.mindskip.xzs.domain.other.KeyValue"> |
| | | SELECT id as value,user_name as name |
| | | from t_user |
| | | where deleted=0 |
| | | and user_name like concat('%' |
| | | , #{value} |
| | | , '%') |
| | | limit 5 |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByIds" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_user |
| | | where id in |
| | | <foreach item="id" collection="list" open="(" separator="," |
| | | close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | <select id="selectByIds" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where id in |
| | | <foreach item="id" collection="list" open="(" separator="," |
| | | close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByWxOpenId" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_user |
| | | where deleted=0 and wx_open_id = #{wxOpenId} |
| | | limit 1 |
| | | </select> |
| | | <select id="selectByWxOpenId" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | where deleted=0 and wx_open_id = #{wxOpenId} |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectByIdName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_user |
| | | <where> |
| | | and deleted=0 and id = #{id} |
| | | <if test="userName != null and userName != ''"> |
| | | and user_name like concat('%',#{userName},"%") |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectByIdName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user |
| | | <where> |
| | | and deleted=0 and id = #{id} |
| | | <if test="userName != null and userName != ''"> |
| | | and user_name like concat('%',#{userName},"%") |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <update id="updateDeptAdmin"> |
| | | UPDATE t_user SET dept_admin = #{deptAdmin} WHERE id = #{id} AND deleted = 0 |
| | | UPDATE t_user_department SET dept_admin = #{deptAdmin} |
| | | <where> |
| | | <if test="ids != null and ids.size > 0"> |
| | | AND user_id in |
| | | <foreach collection="ids" open="(" separator="," close=")" item="id"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND department_id = #{deptId} |
| | | </where> |
| | | </update> |
| | | |
| | | <update id="setStatus"> |
| | |
| | | AND deleted = 0 |
| | | </update> |
| | | |
| | | <select id="getUserByDept" resultType="com.mindskip.xzs.domain.ExamPaperAnswer"> |
| | | SELECT |
| | | <update id="clearDeptAdmin"> |
| | | update |
| | | t_user_department set dept_admin = 0 |
| | | WHERE |
| | | user_id IN <foreach collection="userIds" open="(" separator="," close=")" item="id">#{id}</foreach> |
| | | AND dept_admin = 1 AND department_id = #{deptId} |
| | | </update> |
| | | |
| | | <select id="getUserByDept" resultType="com.mindskip.xzs.domain.ExamPaperAnswer"> |
| | | SELECT |
| | | tu.id as createUser, tu.real_name as userName, count(tepa.id) as counts |
| | | FROM |
| | | t_user tu INNER JOIN t_user_department tud ON tu.id = tud.user_id AND tu.deleted = 0 |
| | | LEFT JOIN t_exam_paper_answer tepa ON tepa.create_user = tu.id |
| | | <where> |
| | | <if test="query.deptId != null"> |
| | | AND tud.department_id = #{query.deptId} |
| | | </if> |
| | | <if test="query.start != null and query.end != null"> |
| | | AND tepa.create_time between #{query.start} and #{query.end} |
| | | </if> |
| | | </where> |
| | | group by |
| | | FROM |
| | | t_user tu INNER JOIN t_user_department tud ON tu.id = tud.user_id AND tu.deleted = 0 |
| | | LEFT JOIN t_exam_paper_answer tepa ON tepa.create_user = tu.id |
| | | <where> |
| | | <if test="query.deptId != null"> |
| | | AND tud.department_id = #{query.deptId} |
| | | </if> |
| | | <if test="query.start != null and query.end != null"> |
| | | AND tepa.create_time between #{query.start} and #{query.end} |
| | | </if> |
| | | </where> |
| | | group by |
| | | createUser, userName |
| | | ORDER BY |
| | | ORDER BY |
| | | tu.id desc |
| | | </select> |
| | | </select> |
| | | |
| | | </mapper> |