| | |
| | | <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> |
| | | and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) |
| | | </if> |
| | | order by id desc |
| | | </select> |
| | | |
| | | <update id="setStatus"> |
| | |
| | | <delete id="deleteStoreRelations"> |
| | | delete from sys_user_store where userId = #{userId} |
| | | </delete> |
| | | <insert id="insertStoreRelations"> |
| | | insert into sys_user_store(id, userId, storeId) values |
| | | <foreach collection="storeIds" item="storeId" separator=","> |
| | | <bind name="relationId" value="@com.baomidou.mybatisplus.core.toolkit.IdWorker@getId()"/> |
| | | (#{relationId}, #{userId}, #{storeId}) |
| | | </foreach> |
| | | <insert id="insertStoreRelation"> |
| | | insert into sys_user_store(id, userId, storeId) values (#{id}, #{userId}, #{storeId}) |
| | | </insert> |
| | | <select id="getStoreIdsByUserId" resultType="java.lang.Integer"> |
| | | select distinct storeId from ( |
| | |
| | | select objectId as storeId from sys_user where id = #{userId} and objectType = 3 and objectId is not null |
| | | union all |
| | | select id as storeId from t_store where storeStaffId = #{userId} |
| | | ) relation_store |
| | | ) relation_store |
| | | </select> |
| | | <select id="getUserIdsByStoreIds" resultType="java.lang.Integer"> |
| | | select distinct userId from ( |
| | | select userId from sys_user_store |
| | | where isDeleted = 0 and storeId in |
| | | <foreach collection="storeIds" separator="," item="storeId" open="(" close=")"> |
| | | #{storeId} |
| | | </foreach> |
| | | union all |
| | | select id as userId from sys_user |
| | | where objectType = 3 and objectId in |
| | | <foreach collection="storeIds" separator="," item="storeId" open="(" close=")"> |
| | | #{storeId} |
| | | </foreach> |
| | | union all |
| | | select storeStaffId as userId from t_store |
| | | where storeStaffId is not null and id in |
| | | <foreach collection="storeIds" separator="," item="storeId" open="(" close=")"> |
| | | #{storeId} |
| | | </foreach> |
| | | ) relation_user |
| | | </select> |
| | | |
| | | <select id="getByAccount" resultType="com.dsh.guns.modular.system.model.User"> |
| | |
| | | </select> |
| | | <select id="searchUsers" resultType="com.dsh.guns.modular.system.model.UserListVO"> |
| | | select t1.id,t1.name ,t1.phone ,t1.avatar,t1.birthday,t1.sex,t1.idCard,t1.status,t1.version |
| | | ,t2.simplename as deptName from sys_user t1 |
| | | ,t2.simplename as deptName, |
| | | (select group_concat(r.name separator ',') from sys_role r where find_in_set(r.id, t1.roleid)) as roleName from sys_user t1 |
| | | left join sys_dept t2 on t1.deptid = t2.id |
| | | <where> |
| | | <if test="query.name != null and query.name != ''"> |
| | |
| | | </if> |
| | | and t1.status != 3 |
| | | </where> |
| | | order by t1.id desc |
| | | </select> |
| | | |
| | | </mapper> |