Commit 8f772efc by duanhq

用户中心更新 by duanht 2019/2/13

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17318 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent a8c12bfe
...@@ -5,6 +5,8 @@ import java.util.List; ...@@ -5,6 +5,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.Validation; import javax.validation.Validation;
import javax.validation.Validator; import javax.validation.Validator;
...@@ -26,6 +28,9 @@ import org.springframework.validation.FieldError; ...@@ -26,6 +28,9 @@ import org.springframework.validation.FieldError;
*/ */
public class BaseController { public class BaseController {
@Resource
protected HttpServletRequest request;
public Logger logger = LoggerFactory.getLogger(getClass()); public Logger logger = LoggerFactory.getLogger(getClass());
/** /**
......
...@@ -47,7 +47,7 @@ public interface SysUserMapper { ...@@ -47,7 +47,7 @@ public interface SysUserMapper {
List<SysMerchant> getSysMerchantList(UserQueryVo userQueryVo); List<SysMerchant> getSysMerchantList(UserQueryVo userQueryVo);
int deleteUserById(Integer[] id); int deleteUserById(UserQueryVo userQueryVo);
List<SysMechanic> getSysMechanicList(UserQueryVo userQueryVo); List<SysMechanic> getSysMechanicList(UserQueryVo userQueryVo);
...@@ -57,5 +57,5 @@ public interface SysUserMapper { ...@@ -57,5 +57,5 @@ public interface SysUserMapper {
List<SysOrganization> getAllLevel(@Param("id") Integer id); List<SysOrganization> getAllLevel(@Param("id") Integer id);
List<SysUser> getMechanicByOrgId(@Param("orgId") Integer orgId); List<SysUser> getMechanicByOrgId(UserQueryVo userQueryVo);
} }
\ No newline at end of file \ No newline at end of file
package com.glsx.usercenter.pojo.vo; package com.glsx.usercenter.pojo.vo;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.Date;
/** /**
* 查询条件基类,所有的QueryVo都要继承这个类 * 查询条件基类,所有的QueryVo都要继承这个类
...@@ -16,35 +16,10 @@ public class BaseQueryVo implements Serializable { ...@@ -16,35 +16,10 @@ public class BaseQueryVo implements Serializable {
* 查询值 * 查询值
*/ */
private Integer id; private Integer id;
private Integer int1;
private Integer int2;
private Integer int3;
private String string1;
private String string2;
private String string3;
/**
* 对应Mapper.xml foreach collection的list/array
*/
// private List<Integer> list;
// private Integer[] array;
/**
* 用户id,分组id,分类id,车辆id,工单id,设备id
* List对应Mapper.xml foreach collection的list
*/
private Integer userId; private Integer userId;
private Integer groupId;
private Integer classId; private Date time;
private Integer vehicleId;
private Integer wordOrderId;
private Integer trackInfoId;
private List<Integer> groupIdList;
private List<Integer> classIdList;
private List<Integer> vehicleIdList;
private List<Integer> wordOrderIdList;
private List<Integer> trackInfoIdList;
/** /**
* 开始时间 * 开始时间
...@@ -61,68 +36,12 @@ public class BaseQueryVo implements Serializable { ...@@ -61,68 +36,12 @@ public class BaseQueryVo implements Serializable {
*/ */
private String cTime; private String cTime;
/** public Date getTime() {
* 追加table关联 return time;
*/ }
private String appendSqlWithTable;
/**
* 追加table关联,带列参数
*/
private String appendSqlWithInTable;
/**
* 权限控制的关联条件(sql语句),追加Where条件
*/
private String appendSqlWithCondition;
/**
* 权限控制的关联条件(sql语句),追加Order排序
*/
private String appendSqlWithOrderByTemp;
/**
* 分组权限控制的表关联
*/
private String appendSqlWithGroupTable;
/**
* 分组权限控制的关联条件(sql语句)
*/
private String appendSqlWithGroupCondition;
/**
* 分类权限控制的表关联
*/
private String appendSqlWithClassTable;
/**
* 分类权限控制的关联条件(sql语句)
*/
private String appendSqlWithClassCondition;
/**
* 映射用户对应车辆关系sql
*/
private String appendSqlWithOrTable;
/**
* 根据时间段拼装sql语句
*/
private String appendSqlByTimeRange;
/** public void setTime(Date time) {
* 清除所有sql this.time = time;
*/
public void emptyAllSql() {
setAppendSqlWithTable("");
setAppendSqlWithInTable("");
setAppendSqlWithCondition("");
setAppendSqlWithOrderByTemp("");
setAppendSqlWithGroupTable("");
setAppendSqlWithGroupCondition("");
setAppendSqlWithClassTable("");
setAppendSqlWithClassCondition("");
} }
public Integer getId() { public Integer getId() {
...@@ -133,54 +52,6 @@ public class BaseQueryVo implements Serializable { ...@@ -133,54 +52,6 @@ public class BaseQueryVo implements Serializable {
this.id = id; this.id = id;
} }
public Integer getInt1() {
return int1;
}
public void setInt1(Integer int1) {
this.int1 = int1;
}
public Integer getInt2() {
return int2;
}
public void setInt2(Integer int2) {
this.int2 = int2;
}
public Integer getInt3() {
return int3;
}
public void setInt3(Integer int3) {
this.int3 = int3;
}
public String getString1() {
return string1;
}
public void setString1(String string1) {
this.string1 = string1;
}
public String getString2() {
return string2;
}
public void setString2(String string2) {
this.string2 = string2;
}
public String getString3() {
return string3;
}
public void setString3(String string3) {
this.string3 = string3;
}
public Integer getUserId() { public Integer getUserId() {
return userId; return userId;
} }
...@@ -189,102 +60,6 @@ public class BaseQueryVo implements Serializable { ...@@ -189,102 +60,6 @@ public class BaseQueryVo implements Serializable {
this.userId = userId; this.userId = userId;
} }
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Integer getClassId() {
return classId;
}
public void setClassId(Integer classId) {
this.classId = classId;
}
public Integer getVehicleId() {
return vehicleId;
}
public void setVehicleId(Integer vehicleId) {
this.vehicleId = vehicleId;
}
public Integer getWordOrderId() {
return wordOrderId;
}
public void setWordOrderId(Integer wordOrderId) {
this.wordOrderId = wordOrderId;
}
public Integer getTrackInfoId() {
return trackInfoId;
}
public void setTrackInfoId(Integer trackInfoId) {
this.trackInfoId = trackInfoId;
}
public List<Integer> getGroupIdList() {
return groupIdList;
}
public void setGroupIdList(List<Integer> groupIdList) {
this.groupIdList = groupIdList;
}
public List<Integer> getClassIdList() {
return classIdList;
}
public void setClassIdList(List<Integer> classIdList) {
this.classIdList = classIdList;
}
public List<Integer> getVehicleIdList() {
return vehicleIdList;
}
public void setVehicleIdList(List<Integer> vehicleIdList) {
this.vehicleIdList = vehicleIdList;
}
public List<Integer> getWordOrderIdList() {
return wordOrderIdList;
}
public void setWordOrderIdList(List<Integer> wordOrderIdList) {
this.wordOrderIdList = wordOrderIdList;
}
public List<Integer> getTrackInfoIdList() {
return trackInfoIdList;
}
public void setTrackInfoIdList(List<Integer> trackInfoIdList) {
this.trackInfoIdList = trackInfoIdList;
}
// public List<Integer> getList() {
// return list;
// }
//
// public void setList(List<Integer> list) {
// this.list = list;
// }
//
// public Integer[] getArray() {
// return array;
// }
//
// public void setArray(Integer[] array) {
// this.array = array;
// }
public String getsTime() { public String getsTime() {
return sTime; return sTime;
} }
...@@ -309,83 +84,4 @@ public class BaseQueryVo implements Serializable { ...@@ -309,83 +84,4 @@ public class BaseQueryVo implements Serializable {
this.cTime = cTime; this.cTime = cTime;
} }
public String getAppendSqlWithTable() {
return appendSqlWithTable;
}
public void setAppendSqlWithTable(String appendSqlWithTable) {
this.appendSqlWithTable = appendSqlWithTable;
}
public String getAppendSqlWithInTable() {
return appendSqlWithInTable;
}
public void setAppendSqlWithInTable(String appendSqlWithInTable) {
this.appendSqlWithInTable = appendSqlWithInTable;
}
public String getAppendSqlWithCondition() {
return appendSqlWithCondition;
}
public void setAppendSqlWithCondition(String appendSqlWithCondition) {
this.appendSqlWithCondition = appendSqlWithCondition;
}
public String getAppendSqlWithOrderByTemp() {
return appendSqlWithOrderByTemp;
}
public void setAppendSqlWithOrderByTemp(String appendSqlWithOrderByTemp) {
this.appendSqlWithOrderByTemp = appendSqlWithOrderByTemp;
}
public String getAppendSqlWithGroupTable() {
return appendSqlWithGroupTable;
}
public void setAppendSqlWithGroupTable(String appendSqlWithGroupTable) {
this.appendSqlWithGroupTable = appendSqlWithGroupTable;
}
public String getAppendSqlWithGroupCondition() {
return appendSqlWithGroupCondition;
}
public void setAppendSqlWithGroupCondition(String appendSqlWithGroupCondition) {
this.appendSqlWithGroupCondition = appendSqlWithGroupCondition;
}
public String getAppendSqlWithClassTable() {
return appendSqlWithClassTable;
}
public void setAppendSqlWithClassTable(String appendSqlWithClassTable) {
this.appendSqlWithClassTable = appendSqlWithClassTable;
}
public String getAppendSqlWithClassCondition() {
return appendSqlWithClassCondition;
}
public void setAppendSqlWithClassCondition(String appendSqlWithClassCondition) {
this.appendSqlWithClassCondition = appendSqlWithClassCondition;
}
public String getAppendSqlWithOrTable() {
return appendSqlWithOrTable;
}
public void setAppendSqlWithOrTable(String appendSqlWithOrTable) {
this.appendSqlWithOrTable = appendSqlWithOrTable;
}
public String getAppendSqlByTimeRange() {
return appendSqlByTimeRange;
}
public void setAppendSqlByTimeRange(String appendSqlByTimeRange) {
this.appendSqlByTimeRange = appendSqlByTimeRange;
}
} }
...@@ -6,9 +6,9 @@ import java.util.List; ...@@ -6,9 +6,9 @@ import java.util.List;
public class UserQueryVo extends BaseQueryVo { public class UserQueryVo extends BaseQueryVo {
/** /**
* 勾选导出 * 多选id
*/ */
private List<Integer> idList; private List<Integer> ids;
/** /**
*登录名称 *登录名称
...@@ -91,15 +91,14 @@ public class UserQueryVo extends BaseQueryVo { ...@@ -91,15 +91,14 @@ public class UserQueryVo extends BaseQueryVo {
this.orgId = orgId; this.orgId = orgId;
} }
public List<Integer> getIdList() { public List<Integer> getIds() {
return idList; return ids;
} }
public void setIdList(List<Integer> idList) { public void setIds(List<Integer> ids) {
this.idList = idList; this.ids = ids;
} }
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
......
...@@ -63,13 +63,13 @@ public interface SysUserService { ...@@ -63,13 +63,13 @@ public interface SysUserService {
SysUser selectByPrimaryKey(Integer id); SysUser selectByPrimaryKey(Integer id);
/** /**
* @param id * @param userQueryVo
* @return int * @return int
* @author duanht * @author duanht
* @Title: deleteUser * @Title: deleteUser
* @Description: TODO 注销用户 * @Description: TODO 注销用户
*/ */
int deleteUser(Integer[] id); int deleteUser(UserQueryVo userQueryVo);
/** /**
* @param userName * @param userName
......
...@@ -4,6 +4,7 @@ package com.glsx.usercenter.service.impl; ...@@ -4,6 +4,7 @@ package com.glsx.usercenter.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.glsx.common.utils.DateUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.IncorrectCredentialsException;
...@@ -153,12 +154,12 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -153,12 +154,12 @@ public class SysUserServiceImpl implements SysUserService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int deleteUser(Integer[] id) { public int deleteUser(UserQueryVo userQueryVo) {
for (Integer userId : id) { for (Integer userId : userQueryVo.getIds()) {
sysUserRoleMapper.deleteByUserId(userId); sysUserRoleMapper.deleteByUserId(userId);
sysUserOrgMapper.deleteByUserId(userId); sysUserOrgMapper.deleteByUserId(userId);
} }
return sysUserMapper.deleteUserById(id); return sysUserMapper.deleteUserById(userQueryVo);
} }
@Override @Override
...@@ -345,7 +346,14 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -345,7 +346,14 @@ public class SysUserServiceImpl implements SysUserService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int updateSysMechanic(SysMechanic sysMechanic) { public int updateSysMechanic(SysMechanic sysMechanic) {
//修改主体信息中的更新人和更新时间
SysUser sysUser = new SysUser();
sysUser.setUpdateBy(sysMechanic.getUpdateBy());
sysUser.setUpdateTime(DateUtil.getCurrentTime());
sysUser.setId(sysMechanic.getId());
sysUserMapper.updateSysUser(sysUser);
return sysUserMapper.updateSysMechanic(sysMechanic); return sysUserMapper.updateSysMechanic(sysMechanic);
} }
...@@ -414,7 +422,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -414,7 +422,7 @@ public class SysUserServiceImpl implements SysUserService {
userQueryVo.setOrgId(sysOrganizations.get(i).getId()); userQueryVo.setOrgId(sysOrganizations.get(i).getId());
//只有机构下面才能有技工 //只有机构下面才能有技工
if (sysOrganizations.get(i).getOrgType() == 2) { if (sysOrganizations.get(i).getOrgType() == 2) {
List<SysUser> sysUserList = sysUserMapper.getMechanicByOrgId(userQueryVo.getOrgId()); List<SysUser> sysUserList = sysUserMapper.getMechanicByOrgId(userQueryVo);
sysOrganizations.get(i).setSysUserList(sysUserList); sysOrganizations.get(i).setSysUserList(sysUserList);
} }
//递归查询子组织 //递归查询子组织
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.usercenter.mapper.SysOrganizationMapper"> <mapper namespace="com.glsx.usercenter.mapper.SysOrganizationMapper">
<resultMap id="BaseResultMap" type="com.glsx.usercenter.pojo.menu.SysOrganization"> <resultMap id="BaseResultMap" type="com.glsx.usercenter.pojo.menu.SysOrganization">
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="parent_id" jdbcType="INTEGER" property="parentId" /> <result column="parent_id" jdbcType="INTEGER" property="parentId"/>
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name"/>
<result column="org_status" jdbcType="TINYINT" property="orgStatus" /> <result column="org_status" jdbcType="TINYINT" property="orgStatus"/>
<result column="org_type" jdbcType="TINYINT" property="orgType" /> <result column="org_type" jdbcType="TINYINT" property="orgType"/>
<result column="sort" jdbcType="INTEGER" property="sort" /> <result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy" /> <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="label" jdbcType="TINYINT" property="label" /> <result column="label" jdbcType="TINYINT" property="label"/>
<result column="org_group" jdbcType="VARCHAR" property="orgGroup" /> <result column="org_group" jdbcType="VARCHAR" property="orgGroup"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -49,16 +50,17 @@ ...@@ -49,16 +50,17 @@
id, parent_id, name, org_status, org_type, sort, create_time, update_time, remark, id, parent_id, name, org_status, org_type, sort, create_time, update_time, remark,
update_by, create_by, label, org_group update_by, create_by, label, org_group
</sql> </sql>
<select id="selectByExample" parameterType="com.glsx.usercenter.pojo.menu.SysOrganizationExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.glsx.usercenter.pojo.menu.SysOrganizationExample"
resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
'false' as QUERYID, 'false' as QUERYID,
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from sys_organization from sys_organization
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
...@@ -66,13 +68,13 @@ ...@@ -66,13 +68,13 @@
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from sys_organization from sys_organization
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_organization DELETE FROM sys_organization
where id = #{id,jdbcType=INTEGER} WHERE id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.glsx.usercenter.pojo.menu.SysOrganization"> <insert id="insert" parameterType="com.glsx.usercenter.pojo.menu.SysOrganization">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
...@@ -214,8 +216,8 @@ ...@@ -214,8 +216,8 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.glsx.usercenter.pojo.menu.SysOrganization"> <update id="updateByPrimaryKey" parameterType="com.glsx.usercenter.pojo.menu.SysOrganization">
update sys_organization UPDATE sys_organization
set parent_id = #{parentId,jdbcType=INTEGER}, SET parent_id = #{parentId,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
org_status = #{orgStatus,jdbcType=TINYINT}, org_status = #{orgStatus,jdbcType=TINYINT},
org_type = #{orgType,jdbcType=TINYINT}, org_type = #{orgType,jdbcType=TINYINT},
...@@ -227,17 +229,18 @@ ...@@ -227,17 +229,18 @@
create_by = #{createBy,jdbcType=VARCHAR}, create_by = #{createBy,jdbcType=VARCHAR},
label = #{label,jdbcType=TINYINT}, label = #{label,jdbcType=TINYINT},
org_group = #{orgGroup,jdbcType=VARCHAR} org_group = #{orgGroup,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} WHERE id = #{id,jdbcType=INTEGER}
</update> </update>
<resultMap id="recursionOrgMap" type="com.glsx.usercenter.pojo.menu.SysOrganization" extends="BaseResultMap" > <resultMap id="recursionOrgMap" type="com.glsx.usercenter.pojo.menu.SysOrganization" extends="BaseResultMap">
<collection property="children" ofType="com.glsx.usercenter.pojo.menu.SysOrganization" column="{id=id,org_status=,org_status}" <collection property="children" ofType="com.glsx.usercenter.pojo.menu.SysOrganization"
select="findOrgByParams" /> column="{id=id,org_status=,org_status}"
select="findOrgByParams"/>
</resultMap> </resultMap>
<select id="findOrgByParams" resultMap="recursionOrgMap" parameterType="java.util.Map" > <select id="findOrgByParams" resultMap="recursionOrgMap" parameterType="java.util.Map">
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from sys_organization WHERE 1=1 from sys_organization WHERE 1=1
<if test="id != null"> <if test="id != null">
and parent_id = #{id} and parent_id = #{id}
...@@ -249,16 +252,31 @@ ...@@ -249,16 +252,31 @@
`sort` ASC `sort` ASC
</select> </select>
<resultMap id="recursionOrgResultMap" type="com.glsx.usercenter.pojo.menu.SysOrganization" extends="BaseResultMap" > <resultMap id="recursionOrgResultMap" type="com.glsx.usercenter.pojo.menu.SysOrganization" extends="BaseResultMap">
<collection property="children" ofType="com.glsx.usercenter.pojo.menu.SysOrganization" column="{id=id,org_status=org_status}" <collection property="children" ofType="com.glsx.usercenter.pojo.menu.SysOrganization"
select="findOrgByParentId" /> column="{id=id,org_status=org_status}"
select="findOrgByParentId"/>
</resultMap> </resultMap>
<select id="findOrgByParentId" resultMap="recursionOrgResultMap"> <select id="findOrgByParentId" resultMap="recursionOrgResultMap">
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from sys_organization WHERE parent_id = #{id} from sys_organization WHERE parent_id = #{id}
and org_status in (0,1) and org_status in (0,1)
ORDER BY ORDER BY
`sort` ASC `sort` ASC
</select> </select>
<select id="getAllGroup" resultType="com.glsx.usercenter.pojo.menu.SysOrganization">
SELECT
so.id id,
so.name name
FROM
sys_user_org uo
LEFT JOIN sys_user u ON uo.org_id = u.org_id
LEFT JOIN sys_organization so ON uo.org_id = so.id
WHERE
uo.user_id = #{id,jdbcType=TINYINT}
AND so.parent_id = #{parentId,jdbcType=TINYINT}
AND so.org_status = 1
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -81,6 +81,19 @@ ...@@ -81,6 +81,19 @@
id, username, name, org_id, phone_number, user_status, create_by, create_time, update_by, id, username, name, org_id, phone_number, user_status, create_by, create_time, update_by,
update_time, password, sex, remark update_time, password, sex, remark
</sql> </sql>
<sql id="getAllGroup">
SELECT DISTINCT
so.id id,
so.NAME NAME,
so.org_type,
uo.user_id
FROM
sys_user u
LEFT JOIN sys_user_org uo ON uo.user_id = u.id
LEFT JOIN sys_organization so ON uo.org_id = so.id
</sql>
<select id="selectByExample" parameterType="com.glsx.usercenter.pojo.user.SysUserExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.glsx.usercenter.pojo.user.SysUserExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
...@@ -568,11 +581,22 @@ ...@@ -568,11 +581,22 @@
occupation, occupation,
u.remark u.remark
FROM FROM
sys_user_org uo sys_user u
LEFT JOIN sys_user u ON uo.org_id = u.org_id LEFT JOIN sys_user_org uo ON uo.org_id = u.org_id
LEFT JOIN sys_organization so ON uo.org_id = so.id LEFT JOIN sys_organization so ON uo.org_id = so.id
LEFT JOIN sys_manager sm ON sm.user_id = u.id LEFT JOIN sys_manager sm ON sm.user_id = u.id
WHERE uo.user_id = #{userId,jdbcType=INTEGER} <choose>
<when test="userStatus != null">
WHERE u.user_status = #{userStatus,jdbcType=TINYINT}
</when>
<otherwise>
WHERE u.user_status &lt;&gt; 2
</otherwise>
</choose>
<if test="userId != 0">
and uo.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="userName != null"> <if test="userName != null">
and u.userName like #{userName,jdbcType=VARCHAR} and u.userName like #{userName,jdbcType=VARCHAR}
</if> </if>
...@@ -584,15 +608,6 @@ ...@@ -584,15 +608,6 @@
<if test="orgId != null"> <if test="orgId != null">
and u.org_id = #{orgId,jdbcType=INTEGER} and u.org_id = #{orgId,jdbcType=INTEGER}
</if> </if>
<choose>
<when test="userStatus != null">
and u.user_status = #{userStatus,jdbcType=TINYINT}
</when>
<otherwise>
and u.user_status &lt;&gt; 2
</otherwise>
</choose>
<if test="sTime != null and eTime!=null and sTime !='' and eTime !=''"> <if test="sTime != null and eTime!=null and sTime !='' and eTime !=''">
and u.create_time between #{sTime,jdbcType=TIMESTAMP} and #{eTime,jdbcType=TIMESTAMP} and u.create_time between #{sTime,jdbcType=TIMESTAMP} and #{eTime,jdbcType=TIMESTAMP}
</if> </if>
...@@ -615,20 +630,22 @@ ...@@ -615,20 +630,22 @@
sdd.data_value serviceItems, sdd.data_value serviceItems,
sm.merchant_status sm.merchant_status
FROM FROM
sys_user_org uo sys_user u
LEFT JOIN sys_user u ON uo.org_id = u.org_id LEFT JOIN sys_user_org uo ON uo.org_id = u.org_id
LEFT JOIN sys_organization so ON uo.org_id = so.id LEFT JOIN sys_organization so ON uo.org_id = so.id
LEFT JOIN sys_merchant sm ON sm.user_id = u.id LEFT JOIN sys_merchant sm ON sm.user_id = u.id
LEFT JOIN sys_user_services sms ON sm.user_id = sms.user_id LEFT JOIN sys_user_services sms ON sm.user_id = sms.user_id
LEFT JOIN sys_dict_data sdd ON sms.service_key = sdd.data_key LEFT JOIN sys_dict_data sdd ON sms.service_key = sdd.data_key
WHERE uo.user_id = #{userId,jdbcType=INTEGER} WHERE u.user_type = 2
AND u.user_type = 2 <if test="userId != 0">
AND uo.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="id != null"> <if test="id != null">
and u.id = #{id,jdbcType=VARCHAR} and u.id = #{id,jdbcType=VARCHAR}
</if> </if>
<if test="serviceItem != null"> <if test="serviceKey != null">
and sdd.data_key = #{serviceItem,jdbcType=VARCHAR} and sdd.data_key = #{serviceKey,jdbcType=VARCHAR}
</if> </if>
<if test="shopName != null"> <if test="shopName != null">
...@@ -659,24 +676,24 @@ ...@@ -659,24 +676,24 @@
</if> </if>
<if test="listType == 3"> <if test="listType == 3">
and u.user_status IN (1)
<choose> <choose>
<when test="userStatus != null"> <when test="userStatus != null">
and u.user_status = #{userStatus,jdbcType=TINYINT} and u.merchant_status = #{userStatus,jdbcType=TINYINT}
</when> </when>
<otherwise> <otherwise>
and u.user_status IN (1)
and sm.merchant_status IN (1,2,3) and sm.merchant_status IN (1,2,3)
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
<if test="listType == 4"> <if test="listType == 4">
and u.user_status IN (1)
<choose> <choose>
<when test="userStatus != null"> <when test="userStatus != null">
and u.user_status = #{userStatus,jdbcType=TINYINT} and u.merchant_status = #{userStatus,jdbcType=TINYINT}
</when> </when>
<otherwise> <otherwise>
and u.user_status IN (1)
and sm.merchant_status IN (2,3) and sm.merchant_status IN (2,3)
</otherwise> </otherwise>
</choose> </choose>
...@@ -706,14 +723,16 @@ ...@@ -706,14 +723,16 @@
sm.work_time_end workTimeEnd, sm.work_time_end workTimeEnd,
sm.dispatch_type dispatchType sm.dispatch_type dispatchType
FROM FROM
sys_user_org uo sys_user u
LEFT JOIN sys_user u ON uo.org_id = u.org_id LEFT JOIN sys_user_org uo ON uo.org_id = u.org_id
LEFT JOIN sys_organization so ON uo.org_id = so.id LEFT JOIN sys_organization so ON uo.org_id = so.id
LEFT JOIN sys_mechanic sm ON sm.user_id = u.id LEFT JOIN sys_mechanic sm ON sm.user_id = u.id
LEFT JOIN sys_user_services sms ON sm.user_id = sms.user_id LEFT JOIN sys_user_services sms ON sm.user_id = sms.user_id
LEFT JOIN sys_dict_data sdd ON sms.service_id = sdd.id LEFT JOIN sys_dict_data sdd ON sms.service_id = sdd.id
WHERE uo.user_id = #{userId,jdbcType=INTEGER} WHERE u.user_type = 3
AND u.user_type = 3 <if test="userId != 0">
AND uo.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="id != null"> <if test="id != null">
and u.id = #{id,jdbcType=VARCHAR} and u.id = #{id,jdbcType=VARCHAR}
</if> </if>
...@@ -753,34 +772,74 @@ ...@@ -753,34 +772,74 @@
</select> </select>
<update id="deleteUserById" parameterType="java.util.List"> <update id="deleteUserById" parameterType="com.glsx.usercenter.pojo.vo.UserQueryVo">
update sys_user update sys_user
set user_status = 2 set user_status = 2,update_by= #{name,jdbcType=VARCHAR},update_time= #{time,jdbcType=TIMESTAMP}
where id in where id in
<foreach collection="list" index="index" item="id" <foreach collection="ids" index="index" item="id"
separator="," open="(" close=")"> separator="," open="(" close=")">
#{id,jdbcType=TINYINT} #{id,jdbcType=TINYINT}
</foreach> </foreach>
</update> </update>
<!--<select id="getOrgList" resultType="com.glsx.usercenter.pojo.menu.SysOrganization">--> <select id="getUserByIdAndName" resultType="com.glsx.usercenter.pojo.user.SysUser">
<!--SELECT--> SELECT
<!--so.id,--> u.id id,
<!--so.name,--> u.name name,
<!--so.sort--> u.org_id orgId
<!--FROM--> FROM
<!--sys_user_org uo--> sys_user u
<!--LEFT JOIN sys_user u ON uo.org_id = u.org_id--> LEFT JOIN sys_user_org uo ON uo.org_id = u.org_id
<!--LEFT JOIN sys_organization so ON uo.org_id = so.id--> LEFT JOIN sys_organization so ON uo.org_id = so.id
<!--WHERE uo.user_id = #{id,jdbcType=INTEGER}--> WHERE u.user_type = 1
<!--<choose>--> <if test="id != 0">
<!--<when test="userStatus != null">--> AND uo.user_id = #{id,jdbcType=INTEGER}
<!--and u.user_status = #{userStatus,jdbcType=TINYINT}--> </if>
<!--</when>--> <if test="name != null">
<!--<otherwise>--> AND u.name LIKE #{name,jdbcType=VARCHAR}
<!--and u.user_status IN (0,1)--> </if>
<!--</otherwise>--> </select>
<!--</choose>-->
<!--</select>--> <resultMap type="com.glsx.usercenter.pojo.menu.SysOrganization" id="sysOrganizationMap">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="org_type" property="orgType"/>
<collection property="children" ofType="com.glsx.usercenter.pojo.menu.SysOrganization"
column="{id=id,userId = user_id}"
select="getAllLevelById"/>
</resultMap>
<select id="getAllLevel" resultMap="sysOrganizationMap">
<include refid="getAllGroup"/>
WHERE so.parent_id = 0
<if test="id != 0">
AND uo.user_id = #{id,jdbcType=INTEGER}
</if>
</select>
<select id="getAllLevelById" resultMap="sysOrganizationMap">
<include refid="getAllGroup"/>
WHERE
so.parent_id = #{id}
<if test="userId != 0">
AND uo.user_id = #{userId,jdbcType=INTEGER}
</if>
</select>
<select id="getMechanicByOrgId" parameterType="com.glsx.usercenter.pojo.vo.UserQueryVo"
resultType="com.glsx.usercenter.pojo.user.SysUser">
SELECT
su.name name,
su.phone_number phoneNumber,
su.id
FROM sys_resource_matching srm LEFT JOIN sys_service_mechanic ssm ON srm.user_id = ssm.service_id
LEFT JOIN sys_user su ON ssm.mechanic_id = su.id
WHERE srm.merchant_id = #{id,jdbcType=INTEGER} AND srm.service_key = #{serviceKey,jdbcType=VARCHAR}
AND su.user_status = 1
<if test="orgId != null">
AND su.org_id = #{orgId,jdbcType=INTEGER}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!