Commit 28fd9ccd authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 032aa26b 8a2e7cd7
...@@ -2,6 +2,9 @@ package com.mortals.xhx.module.workman.model; ...@@ -2,6 +2,9 @@ package com.mortals.xhx.module.workman.model;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.mortals.xhx.module.workman.model.vo.WorkmanVo; import com.mortals.xhx.module.workman.model.vo.WorkmanVo;
import java.util.Date;
/** /**
* 工作人员实体对象 * 工作人员实体对象
* *
...@@ -105,6 +108,14 @@ public class WorkmanEntity extends WorkmanVo { ...@@ -105,6 +108,14 @@ public class WorkmanEntity extends WorkmanVo {
*/ */
@JSONField(serialize = false) @JSONField(serialize = false)
private String loginPwd; private String loginPwd;
/**
* 最后一次登录时间
*/
private Date lastLoginTime;
/**
* 最后一次登录地址
*/
private String lastLoginAddress;
public WorkmanEntity(){} public WorkmanEntity(){}
...@@ -431,7 +442,34 @@ public class WorkmanEntity extends WorkmanVo { ...@@ -431,7 +442,34 @@ public class WorkmanEntity extends WorkmanVo {
this.loginPwd = loginPwd; this.loginPwd = loginPwd;
} }
/**
* 获取 最后一次登录时间
* @return Date
*/
public Date getLastLoginTime(){
return lastLoginTime;
}
/**
* 设置 最后一次登录时间
* @param lastLoginTime
*/
public void setLastLoginTime(Date lastLoginTime){
this.lastLoginTime = lastLoginTime;
}
/**
* 获取 最后一次登录地址
* @return String
*/
public String getLastLoginAddress(){
return lastLoginAddress;
}
/**
* 设置 最后一次登录地址
* @param lastLoginAddress
*/
public void setLastLoginAddress(String lastLoginAddress){
this.lastLoginAddress = lastLoginAddress;
}
@Override @Override
...@@ -475,6 +513,8 @@ public class WorkmanEntity extends WorkmanVo { ...@@ -475,6 +513,8 @@ public class WorkmanEntity extends WorkmanVo {
sb.append(",online:").append(getOnline()); sb.append(",online:").append(getOnline());
sb.append(",loginName:").append(getLoginName()); sb.append(",loginName:").append(getLoginName());
sb.append(",loginPwd:").append(getLoginPwd()); sb.append(",loginPwd:").append(getLoginPwd());
sb.append(",lastLoginTime:").append(getLastLoginTime());
sb.append(",lastLoginAddress:").append(getLastLoginAddress());
return sb.toString(); return sb.toString();
} }
...@@ -525,5 +565,9 @@ public class WorkmanEntity extends WorkmanVo { ...@@ -525,5 +565,9 @@ public class WorkmanEntity extends WorkmanVo {
this.loginName = ""; this.loginName = "";
this.loginPwd = ""; this.loginPwd = "";
this.lastLoginTime = null;
this.lastLoginAddress = "";
} }
} }
\ No newline at end of file
...@@ -177,6 +177,15 @@ public class WorkmanQuery extends WorkmanEntity { ...@@ -177,6 +177,15 @@ public class WorkmanQuery extends WorkmanEntity {
/** 密码 */ /** 密码 */
private List<String> loginPwdList; private List<String> loginPwdList;
/** 开始 最后一次登录时间 */
private String lastLoginTimeStart;
/** 结束 最后一次登录时间 */
private String lastLoginTimeEnd;
/** 最后一次登录地址 */
private List<String> lastLoginAddressList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<WorkmanQuery> orConditionList; private List<WorkmanQuery> orConditionList;
...@@ -1065,6 +1074,55 @@ public class WorkmanQuery extends WorkmanEntity { ...@@ -1065,6 +1074,55 @@ public class WorkmanQuery extends WorkmanEntity {
public void setLoginPwdList(List<String> loginPwdList){ public void setLoginPwdList(List<String> loginPwdList){
this.loginPwdList = loginPwdList; this.loginPwdList = loginPwdList;
} }
/**
* 获取 开始 最后一次登录时间
* @return lastLoginTimeStart
*/
public String getLastLoginTimeStart(){
return this.lastLoginTimeStart;
}
/**
* 设置 开始 最后一次登录时间
* @param lastLoginTimeStart
*/
public void setLastLoginTimeStart(String lastLoginTimeStart){
this.lastLoginTimeStart = lastLoginTimeStart;
}
/**
* 获取 结束 最后一次登录时间
* @return lastLoginTimeEnd
*/
public String getLastLoginTimeEnd(){
return this.lastLoginTimeEnd;
}
/**
* 设置 结束 最后一次登录时间
* @param lastLoginTimeEnd
*/
public void setLastLoginTimeEnd(String lastLoginTimeEnd){
this.lastLoginTimeEnd = lastLoginTimeEnd;
}
/**
* 获取 最后一次登录地址
* @return lastLoginAddressList
*/
public List<String> getLastLoginAddressList(){
return this.lastLoginAddressList;
}
/**
* 设置 最后一次登录地址
* @param lastLoginAddressList
*/
public void setLastLoginAddressList(List<String> lastLoginAddressList){
this.lastLoginAddressList = lastLoginAddressList;
}
/** /**
* 设置 序号,主键,自增长 * 设置 序号,主键,自增长
* @param id * @param id
......
...@@ -20,10 +20,11 @@ public interface WorkmanService extends ICRUDCacheService<WorkmanEntity,Long> { ...@@ -20,10 +20,11 @@ public interface WorkmanService extends ICRUDCacheService<WorkmanEntity,Long> {
* *
* @param loginName 登录用户名 * @param loginName 登录用户名
* @param password 登录密码 * @param password 登录密码
* @param ip ip地址
* @return * @return
* @throws AppException * @throws AppException
*/ */
WorkmanEntity doLogin(String loginName, String password) throws AppException; WorkmanEntity doLogin(String loginName, String password,String ip) throws AppException;
......
...@@ -88,7 +88,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao, ...@@ -88,7 +88,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
@Override @Override
public WorkmanEntity doLogin(String loginName, String password) throws AppException { public WorkmanEntity doLogin(String loginName, String password,String loginIp) throws AppException {
WorkmanEntity workmanEntity = this.selectOne(new WorkmanQuery().loginName(loginName)); WorkmanEntity workmanEntity = this.selectOne(new WorkmanQuery().loginName(loginName));
if (workmanEntity == null || !workmanEntity.getLoginName().equals(loginName)) { if (workmanEntity == null || !workmanEntity.getLoginName().equals(loginName)) {
throw new AppException("用户名不存在!"); throw new AppException("用户名不存在!");
...@@ -100,7 +100,11 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao, ...@@ -100,7 +100,11 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码验认出错!", e); throw new AppException("密码验认出错!", e);
} }
WorkmanEntity update = new WorkmanEntity();
update.setId(workmanEntity.getId());
update.setLastLoginAddress(loginIp);
update.setLastLoginTime(new Date());
this.dao.update(update);
return workmanEntity; return workmanEntity;
} }
......
...@@ -63,7 +63,8 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman ...@@ -63,7 +63,8 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
public String doLogin(@RequestBody WorkmanEntity query) { public String doLogin(@RequestBody WorkmanEntity query) {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
try { try {
WorkmanEntity workmanEntity = this.service.doLogin(query.getLoginName(), query.getLoginPwd()); String ip = super.getRequestIP(request);
WorkmanEntity workmanEntity = this.service.doLogin(query.getLoginName(), query.getLoginPwd(),ip);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "工作人员登录成功!"); ret.put(KEY_RESULT_MSG, "工作人员登录成功!");
ret.put(KEY_RESULT_DATA, workmanEntity); ret.put(KEY_RESULT_DATA, workmanEntity);
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
<!-- 字段和属性映射 --> <!-- 字段和属性映射 -->
<resultMap type="WorkmanEntity" id="WorkmanEntity-Map"> <resultMap type="WorkmanEntity" id="WorkmanEntity-Map">
<id property="id" column="id" /> <id property="id" column="id" />
<result property="loginName" column="loginName" />
<result property="loginPwd" column="loginPwd" />
<result property="deptId" column="deptId" /> <result property="deptId" column="deptId" />
<result property="deptName" column="deptName" /> <result property="deptName" column="deptName" />
<result property="windowId" column="windowId" /> <result property="windowId" column="windowId" />
...@@ -30,8 +32,8 @@ ...@@ -30,8 +32,8 @@
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" /> <result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
<result property="loginName" column="loginName" /> <result property="lastLoginTime" column="lastLoginTime" />
<result property="loginPwd" column="loginPwd" /> <result property="lastLoginAddress" column="lastLoginAddress" />
</resultMap> </resultMap>
...@@ -42,6 +44,12 @@ ...@@ -42,6 +44,12 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id, a.id,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginName') or colPickMode == 1 and data.containsKey('loginName')))">
a.loginName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginPwd') or colPickMode == 1 and data.containsKey('loginPwd')))">
a.loginPwd,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deptId') or colPickMode == 1 and data.containsKey('deptId')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deptId') or colPickMode == 1 and data.containsKey('deptId')))">
a.deptId, a.deptId,
</if> </if>
...@@ -114,29 +122,29 @@ ...@@ -114,29 +122,29 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime, a.updateTime,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginName') or colPickMode == 1 and data.containsKey('loginName')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginTime') or colPickMode == 1 and data.containsKey('lastLoginTime')))">
a.loginName, a.lastLoginTime,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginPwd') or colPickMode == 1 and data.containsKey('loginPwd')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginAddress') or colPickMode == 1 and data.containsKey('lastLoginAddress')))">
a.loginPwd, a.lastLoginAddress,
</if> </if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="WorkmanEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="WorkmanEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_sys_workman insert into mortals_sys_workman
(deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime,loginName,loginPwd) (loginName,loginPwd,deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime,lastLoginTime,lastLoginAddress)
VALUES VALUES
(#{deptId},#{deptName},#{windowId},#{windowName},#{siteId},#{siteName},#{name},#{number},#{userpost},#{posttitle},#{politicalstatus},#{dangyuan},#{phone},#{mobile},#{starlevel},#{summary},#{photoPath},#{duty},#{promise},#{business},#{online},#{createTime},#{createUserId},#{updateTime},#{loginName},#{loginPwd}) (#{loginName},#{loginPwd},#{deptId},#{deptName},#{windowId},#{windowName},#{siteId},#{siteName},#{name},#{number},#{userpost},#{posttitle},#{politicalstatus},#{dangyuan},#{phone},#{mobile},#{starlevel},#{summary},#{photoPath},#{duty},#{promise},#{business},#{online},#{createTime},#{createUserId},#{updateTime},#{lastLoginTime},#{lastLoginAddress})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_sys_workman insert into mortals_sys_workman
(deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime,loginName,loginPwd) (loginName,loginPwd,deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime,lastLoginTime,lastLoginAddress)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.deptId},#{item.deptName},#{item.windowId},#{item.windowName},#{item.siteId},#{item.siteName},#{item.name},#{item.number},#{item.userpost},#{item.posttitle},#{item.politicalstatus},#{item.dangyuan},#{item.phone},#{item.mobile},#{item.starlevel},#{item.summary},#{item.photoPath},#{item.duty},#{item.promise},#{item.business},#{item.online},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.loginName},#{item.loginPwd}) (#{item.loginName},#{item.loginPwd},#{item.deptId},#{item.deptName},#{item.windowId},#{item.windowName},#{item.siteId},#{item.siteName},#{item.name},#{item.number},#{item.userpost},#{item.posttitle},#{item.politicalstatus},#{item.dangyuan},#{item.phone},#{item.mobile},#{item.starlevel},#{item.summary},#{item.photoPath},#{item.duty},#{item.promise},#{item.business},#{item.online},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.lastLoginTime},#{item.lastLoginAddress})
</foreach> </foreach>
</insert> </insert>
...@@ -146,6 +154,12 @@ ...@@ -146,6 +154,12 @@
update mortals_sys_workman as a update mortals_sys_workman as a
set set
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('loginName')) or (colPickMode==1 and !data.containsKey('loginName'))">
a.loginName=#{data.loginName},
</if>
<if test="(colPickMode==0 and data.containsKey('loginPwd')) or (colPickMode==1 and !data.containsKey('loginPwd'))">
a.loginPwd=#{data.loginPwd},
</if>
<if test="(colPickMode==0 and data.containsKey('deptId')) or (colPickMode==1 and !data.containsKey('deptId'))"> <if test="(colPickMode==0 and data.containsKey('deptId')) or (colPickMode==1 and !data.containsKey('deptId'))">
a.deptId=#{data.deptId}, a.deptId=#{data.deptId},
</if> </if>
...@@ -242,11 +256,11 @@ ...@@ -242,11 +256,11 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))"> <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime}, a.updateTime=#{data.updateTime},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('loginName')) or (colPickMode==1 and !data.containsKey('loginName'))"> <if test="(colPickMode==0 and data.containsKey('lastLoginTime')) or (colPickMode==1 and !data.containsKey('lastLoginTime'))">
a.loginName=#{data.loginName}, a.lastLoginTime=#{data.lastLoginTime},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('loginPwd')) or (colPickMode==1 and !data.containsKey('loginPwd'))"> <if test="(colPickMode==0 and data.containsKey('lastLoginAddress')) or (colPickMode==1 and !data.containsKey('lastLoginAddress'))">
a.loginPwd=#{data.loginPwd}, a.lastLoginAddress=#{data.lastLoginAddress},
</if> </if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
...@@ -260,6 +274,20 @@ ...@@ -260,6 +274,20 @@
<update id="updateBatch" parameterType="paramDto"> <update id="updateBatch" parameterType="paramDto">
update mortals_sys_workman as a update mortals_sys_workman as a
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="loginName=(case" suffix="ELSE loginName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('loginName')) or (colPickMode==1 and !item.containsKey('loginName'))">
when a.id=#{item.id} then #{item.loginName}
</if>
</foreach>
</trim>
<trim prefix="loginPwd=(case" suffix="ELSE loginPwd end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('loginPwd')) or (colPickMode==1 and !item.containsKey('loginPwd'))">
when a.id=#{item.id} then #{item.loginPwd}
</if>
</foreach>
</trim>
<trim prefix="deptId=(case" suffix="ELSE deptId end),"> <trim prefix="deptId=(case" suffix="ELSE deptId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<choose> <choose>
...@@ -468,17 +496,17 @@ ...@@ -468,17 +496,17 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="loginName=(case" suffix="ELSE loginName end),"> <trim prefix="lastLoginTime=(case" suffix="ELSE lastLoginTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('loginName')) or (colPickMode==1 and !item.containsKey('loginName'))"> <if test="(colPickMode==0 and item.containsKey('lastLoginTime')) or (colPickMode==1 and !item.containsKey('lastLoginTime'))">
when a.id=#{item.id} then #{item.loginName} when a.id=#{item.id} then #{item.lastLoginTime}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="loginPwd=(case" suffix="ELSE loginPwd end),"> <trim prefix="lastLoginAddress=(case" suffix="ELSE lastLoginAddress end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('loginPwd')) or (colPickMode==1 and !item.containsKey('loginPwd'))"> <if test="(colPickMode==0 and item.containsKey('lastLoginAddress')) or (colPickMode==1 and !item.containsKey('lastLoginAddress'))">
when a.id=#{item.id} then #{item.loginPwd} when a.id=#{item.id} then #{item.lastLoginAddress}
</if> </if>
</foreach> </foreach>
</trim> </trim>
...@@ -604,6 +632,36 @@ ...@@ -604,6 +632,36 @@
${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd} ${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
</if> </if>
<if test="conditionParamRef.containsKey('loginName')">
<if test="conditionParamRef.loginName != null and conditionParamRef.loginName != ''">
${_conditionType_} a.loginName like #{${_conditionParam_}.loginName}
</if>
<if test="conditionParamRef.loginName == null">
${_conditionType_} a.loginName is null
</if>
</if>
<if test="conditionParamRef.containsKey('loginNameList')">
${_conditionType_} a.loginName in
<foreach collection="conditionParamRef.loginNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('loginPwd')">
<if test="conditionParamRef.loginPwd != null and conditionParamRef.loginPwd != ''">
${_conditionType_} a.loginPwd like #{${_conditionParam_}.loginPwd}
</if>
<if test="conditionParamRef.loginPwd == null">
${_conditionType_} a.loginPwd is null
</if>
</if>
<if test="conditionParamRef.containsKey('loginPwdList')">
${_conditionType_} a.loginPwd in
<foreach collection="conditionParamRef.loginPwdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('deptId')"> <if test="conditionParamRef.containsKey('deptId')">
<if test="conditionParamRef.deptId != null "> <if test="conditionParamRef.deptId != null ">
${_conditionType_} a.deptId = #{${_conditionParam_}.deptId} ${_conditionType_} a.deptId = #{${_conditionParam_}.deptId}
...@@ -1013,32 +1071,32 @@ ...@@ -1013,32 +1071,32 @@
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if> </if>
<if test="conditionParamRef.containsKey('loginName')"> <if test="conditionParamRef.containsKey('lastLoginTime')">
<if test="conditionParamRef.loginName != null and conditionParamRef.loginName != ''"> <if test="conditionParamRef.lastLoginTime != null ">
${_conditionType_} a.loginName like #{${_conditionParam_}.loginName} ${_conditionType_} a.lastLoginTime = #{${_conditionParam_}.lastLoginTime}
</if> </if>
<if test="conditionParamRef.loginName == null"> <if test="conditionParamRef.lastLoginTime == null">
${_conditionType_} a.loginName is null ${_conditionType_} a.lastLoginTime is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('loginNameList')"> <if test="conditionParamRef.containsKey('lastLoginTimeStart') and conditionParamRef.lastLoginTimeStart != null and conditionParamRef.lastLoginTimeStart!=''">
${_conditionType_} a.loginName in ${_conditionType_} a.lastLoginTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.lastLoginTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
<foreach collection="conditionParamRef.loginNameList" open="(" close=")" index="index" item="item" separator=","> </if>
#{item} <if test="conditionParamRef.containsKey('lastLoginTimeEnd') and conditionParamRef.lastLoginTimeEnd != null and conditionParamRef.lastLoginTimeEnd!=''">
</foreach> ${_conditionType_} a.lastLoginTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.lastLoginTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if> </if>
<if test="conditionParamRef.containsKey('loginPwd')"> <if test="conditionParamRef.containsKey('lastLoginAddress')">
<if test="conditionParamRef.loginPwd != null and conditionParamRef.loginPwd != ''"> <if test="conditionParamRef.lastLoginAddress != null and conditionParamRef.lastLoginAddress != ''">
${_conditionType_} a.loginPwd like #{${_conditionParam_}.loginPwd} ${_conditionType_} a.lastLoginAddress like #{${_conditionParam_}.lastLoginAddress}
</if> </if>
<if test="conditionParamRef.loginPwd == null"> <if test="conditionParamRef.lastLoginAddress == null">
${_conditionType_} a.loginPwd is null ${_conditionType_} a.lastLoginAddress is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('loginPwdList')"> <if test="conditionParamRef.containsKey('lastLoginAddressList')">
${_conditionType_} a.loginPwd in ${_conditionType_} a.lastLoginAddress in
<foreach collection="conditionParamRef.loginPwdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.lastLoginAddressList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
...@@ -1060,6 +1118,16 @@ ...@@ -1060,6 +1118,16 @@
<if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if> <if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('loginName')">
a.loginName
<if test='orderCol.loginName != null and "DESC".equalsIgnoreCase(orderCol.loginName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('loginPwd')">
a.loginPwd
<if test='orderCol.loginPwd != null and "DESC".equalsIgnoreCase(orderCol.loginPwd)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('deptId')"> <if test="orderCol.containsKey('deptId')">
a.deptId a.deptId
<if test='orderCol.deptId != null and "DESC".equalsIgnoreCase(orderCol.deptId)'>DESC</if> <if test='orderCol.deptId != null and "DESC".equalsIgnoreCase(orderCol.deptId)'>DESC</if>
...@@ -1180,14 +1248,14 @@ ...@@ -1180,14 +1248,14 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if> <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('loginName')"> <if test="orderCol.containsKey('lastLoginTime')">
a.loginName a.lastLoginTime
<if test='orderCol.loginName != null and "DESC".equalsIgnoreCase(orderCol.loginName)'>DESC</if> <if test='orderCol.lastLoginTime != null and "DESC".equalsIgnoreCase(orderCol.lastLoginTime)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('loginPwd')"> <if test="orderCol.containsKey('lastLoginAddress')">
a.loginPwd a.lastLoginAddress
<if test='orderCol.loginPwd != null and "DESC".equalsIgnoreCase(orderCol.loginPwd)'>DESC</if> <if test='orderCol.lastLoginAddress != null and "DESC".equalsIgnoreCase(orderCol.lastLoginAddress)'>DESC</if>
, ,
</if> </if>
</trim> </trim>
......
...@@ -954,14 +954,13 @@ data|object|数据对象 ...@@ -954,14 +954,13 @@ data|object|数据对象
&emsp;&emsp;roleCode|String|角色编码 &emsp;&emsp;roleCode|String|角色编码
&emsp;&emsp;roleSort|Integer|角色排序字段 &emsp;&emsp;roleSort|Integer|角色排序字段
&emsp;&emsp;remark|String|备注 &emsp;&emsp;remark|String|备注
&emsp;&emsp;roleType|Integer|角色状态(0.停用,1.启用)
&emsp;&emsp;menuIdList|Arrays|菜单ID列表,值为long &emsp;&emsp;menuIdList|Arrays|菜单ID列表,值为long
&emsp;&emsp;createTime|Date|创建时间 &emsp;&emsp;createTime|Date|创建时间
&emsp;&emsp;createUserId|Long|创建用户 &emsp;&emsp;createUserId|Long|创建用户
&emsp;&emsp;createUserName|String|创建用户名称 &emsp;&emsp;createUserName|String|创建用户名称
dict|object|字典对象 dict|object|字典对象
&emsp;roleType|object|字典属性对象,详见附录 &emsp;roleType|object|字典属性对象,详见附录
&emsp;roleType|object|字典属性对象,详见附录 &emsp;status|object|字典属性对象,详见附录
**响应消息样例:** **响应消息样例:**
``` ```
...@@ -1003,15 +1002,13 @@ data|object|数据对象 ...@@ -1003,15 +1002,13 @@ data|object|数据对象
&emsp;name|String|角色名称 &emsp;name|String|角色名称
&emsp;roleCode|String|角色编码 &emsp;roleCode|String|角色编码
&emsp;roleSort|Integer|角色排序字段 &emsp;roleSort|Integer|角色排序字段
&emsp;roleType|Integer|角色类型(0.系统内置角色,1.默认系统角色,2.普通角色)
&emsp;remark|String|备注 &emsp;remark|String|备注
&emsp;roleType|Integer|角色状态(0.停用,1.启用)
&emsp;createTime|Date|创建时间 &emsp;createTime|Date|创建时间
&emsp;createUserId|Long|创建用户 &emsp;createUserId|Long|创建用户
&emsp;createUserName|String|创建用户名称 &emsp;createUserName|String|创建用户名称
dict|object|字典对象 dict|object|字典对象
&emsp;roleType|object|字典属性对象,详见附录 &emsp;roleType|object|字典属性对象,详见附录
&emsp;roleType|object|字典属性对象,详见附录 &emsp;status|object|字典属性对象,详见附录
**响应消息样例:** **响应消息样例:**
``` ```
...@@ -1022,9 +1019,7 @@ dict|object|字典对象 ...@@ -1022,9 +1019,7 @@ dict|object|字典对象
"name":"c9szsk", "name":"c9szsk",
"roleCode":"c2f41g", "roleCode":"c2f41g",
"roleSort":2788, "roleSort":2788,
"roleType":541,
"remark":"tym2dx", "remark":"tym2dx",
"roleType":3737,
"createTime":"2022-06-02", "createTime":"2022-06-02",
"createUserId":5091, "createUserId":5091,
"createUserName":"zx9ud1" "createUserName":"zx9ud1"
...@@ -1049,9 +1044,7 @@ dict|object|字典对象 ...@@ -1049,9 +1044,7 @@ dict|object|字典对象
name|String|是|角色名称 name|String|是|角色名称
roleCode|String|是|角色编码 roleCode|String|是|角色编码
roleSort|Integer|是|角色排序字段 roleSort|Integer|是|角色排序字段
roleType|Integer|是|角色类型(0.系统内置角色,1.默认系统角色,2.普通角色)
remark|String|是|备注 remark|String|是|备注
roleType|Integer|是|角色状态(0.停用,1.启用)
createUserName|String|是|创建用户名称 createUserName|String|是|创建用户名称
**请求样例:** **请求样例:**
...@@ -1060,9 +1053,7 @@ createUserName|String|是|创建用户名称 ...@@ -1060,9 +1053,7 @@ createUserName|String|是|创建用户名称
"name":"i8scn3", "name":"i8scn3",
"roleCode":"nthtg2", "roleCode":"nthtg2",
"roleSort":3063, "roleSort":3063,
"roleType":6039,
"remark":"32xaq6", "remark":"32xaq6",
"roleType":3352,
"createUserName":"ztwqjn" "createUserName":"ztwqjn"
} }
...@@ -1080,9 +1071,7 @@ data|object|数据对象 ...@@ -1080,9 +1071,7 @@ data|object|数据对象
&emsp;&emsp;name|String|角色名称 &emsp;&emsp;name|String|角色名称
&emsp;&emsp;roleCode|String|角色编码 &emsp;&emsp;roleCode|String|角色编码
&emsp;&emsp;roleSort|Integer|角色排序字段 &emsp;&emsp;roleSort|Integer|角色排序字段
&emsp;&emsp;roleType|Integer|角色类型(0.系统内置角色,1.默认系统角色,2.普通角色)
&emsp;&emsp;remark|String|备注 &emsp;&emsp;remark|String|备注
&emsp;&emsp;roleType|Integer|角色状态(0.停用,1.启用)
&emsp;&emsp;createTime|Date|创建时间 &emsp;&emsp;createTime|Date|创建时间
&emsp;&emsp;createUserId|Long|创建用户 &emsp;&emsp;createUserId|Long|创建用户
&emsp;&emsp;createUserName|String|创建用户名称 &emsp;&emsp;createUserName|String|创建用户名称
...@@ -1297,6 +1286,7 @@ data|object|数据对象 ...@@ -1297,6 +1286,7 @@ data|object|数据对象
&emsp;&emsp;createTime|Date|创建时间 &emsp;&emsp;createTime|Date|创建时间
&emsp;&emsp;createUserId|Long|创建用户 &emsp;&emsp;createUserId|Long|创建用户
&emsp;&emsp;createUserName|String|创建用户名称 &emsp;&emsp;createUserName|String|创建用户名称
&emsp;&emsp;remark|String|描述备注
dict|object|字典对象 dict|object|字典对象
&emsp;linkType|object|字典属性对象,详见附录 &emsp;linkType|object|字典属性对象,详见附录
&emsp;visible|object|字典属性对象,详见附录 &emsp;visible|object|字典属性对象,详见附录
...@@ -1474,6 +1464,7 @@ data|object|数据对象 ...@@ -1474,6 +1464,7 @@ data|object|数据对象
&emsp;createTime|Date|创建时间 &emsp;createTime|Date|创建时间
&emsp;createUserId|Long|创建用户 &emsp;createUserId|Long|创建用户
&emsp;createUserName|String|创建用户名称 &emsp;createUserName|String|创建用户名称
&emsp;&emsp;remark|String|描述备注
dict|object|字典对象 dict|object|字典对象
&emsp;linkType|object|字典属性对象,详见附录 &emsp;linkType|object|字典属性对象,详见附录
&emsp;visible|object|字典属性对象,详见附录 &emsp;visible|object|字典属性对象,详见附录
...@@ -1501,7 +1492,8 @@ dict|object|字典对象 ...@@ -1501,7 +1492,8 @@ dict|object|字典对象
"orderId":6861, "orderId":6861,
"createTime":"2022-06-02", "createTime":"2022-06-02",
"createUserId":2189, "createUserId":2189,
"createUserName":"zov8bo" "createUserName":"zov8bo",
"remark":"zov8bo"
} }
} }
``` ```
...@@ -1532,7 +1524,7 @@ menuType|Integer|是|菜单类型(0.目录,1.菜单,2.按钮) ...@@ -1532,7 +1524,7 @@ menuType|Integer|是|菜单类型(0.目录,1.菜单,2.按钮)
status|Integer|是|菜单状态(0.禁用,1.启用) status|Integer|是|菜单状态(0.禁用,1.启用)
authType|Integer|是|权限类型(0.无限制,1.无需登录查看,2.需要登录查看,3.需要角色权限查看) authType|Integer|是|权限类型(0.无限制,1.无需登录查看,2.需要登录查看,3.需要角色权限查看)
orderId|Integer|是|排序编号 orderId|Integer|是|排序编号
createUserName|String|是|创建用户名称 remark|String|是|描述备注
**请求样例:** **请求样例:**
``` ```
...@@ -1548,7 +1540,8 @@ createUserName|String|是|创建用户名称 ...@@ -1548,7 +1540,8 @@ createUserName|String|是|创建用户名称
"menuType":0, "menuType":0,
"status":1, "status":1,
"authType":3, "authType":3,
"orderId":0 "orderId":0,
"remark":"qnglei"
} }
``` ```
...@@ -1577,6 +1570,7 @@ data|object|数据对象 ...@@ -1577,6 +1570,7 @@ data|object|数据对象
&emsp;&emsp;createTime|Date|创建时间 &emsp;&emsp;createTime|Date|创建时间
&emsp;&emsp;createUserId|Long|创建用户 &emsp;&emsp;createUserId|Long|创建用户
&emsp;&emsp;createUserName|String|创建用户名称 &emsp;&emsp;createUserName|String|创建用户名称
&emsp;&emsp;remark|String|描述备注
**响应消息样例:** **响应消息样例:**
``` ```
......
...@@ -64,7 +64,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -64,7 +64,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
//不存在时候 如果是管理员也不做拦截 //不存在时候 如果是管理员也不做拦截
IUser loginUser = authTokenService.getLoginUser(request); IUser loginUser = authTokenService.getLoginUser(request);
if(ObjectUtils.isEmpty(loginUser)){ if(ObjectUtils.isEmpty(loginUser)){
ret.put("code", -1); ret.put("code", 401);
ret.put("msg", "用户未登录或登录失效,请重新登录"); ret.put("msg", "用户未登录或登录失效,请重新登录");
ServletUtils.renderString(response, JSONObject.toJSONString(ret)); ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false; return false;
......
...@@ -7,11 +7,11 @@ import com.mortals.framework.annotation.Excel; ...@@ -7,11 +7,11 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.menu.model.vo.MenuVo; import com.mortals.xhx.module.menu.model.vo.MenuVo;
/** /**
* 菜单信息业务实体对象 * 菜单信息业务实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-06-02 * @date 2022-08-02
*/ */
public class MenuEntity extends MenuVo { public class MenuEntity extends MenuVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -68,6 +68,10 @@ public class MenuEntity extends MenuVo { ...@@ -68,6 +68,10 @@ public class MenuEntity extends MenuVo {
* 创建用户名称 * 创建用户名称
*/ */
private String createUserName; private String createUserName;
/**
* 描述备注
*/
private String remark;
...@@ -254,6 +258,20 @@ public class MenuEntity extends MenuVo { ...@@ -254,6 +258,20 @@ public class MenuEntity extends MenuVo {
public void setCreateUserName(String createUserName){ public void setCreateUserName(String createUserName){
this.createUserName = createUserName; this.createUserName = createUserName;
} }
/**
* 获取 描述备注
* @return String
*/
public String getRemark(){
return remark;
}
/**
* 设置 描述备注
* @param remark
*/
public void setRemark(String remark){
this.remark = remark;
}
...@@ -289,6 +307,7 @@ public class MenuEntity extends MenuVo { ...@@ -289,6 +307,7 @@ public class MenuEntity extends MenuVo {
sb.append(",authType:").append(getAuthType()); sb.append(",authType:").append(getAuthType());
sb.append(",orderId:").append(getOrderId()); sb.append(",orderId:").append(getOrderId());
sb.append(",createUserName:").append(getCreateUserName()); sb.append(",createUserName:").append(getCreateUserName());
sb.append(",remark:").append(getRemark());
return sb.toString(); return sb.toString();
} }
...@@ -319,5 +338,7 @@ public class MenuEntity extends MenuVo { ...@@ -319,5 +338,7 @@ public class MenuEntity extends MenuVo {
this.orderId = 0; this.orderId = 0;
this.createUserName = ""; this.createUserName = "";
this.remark = "";
} }
} }
\ No newline at end of file
...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.menu.model; ...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.menu.model;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.menu.model.MenuEntity; import com.mortals.xhx.module.menu.model.MenuEntity;
/** /**
* 菜单信息业务查询对象 * 菜单信息业务查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-06-02 * @date 2022-08-02
*/ */
public class MenuQuery extends MenuEntity { public class MenuQuery extends MenuEntity {
/** 开始 菜单ID,主键,自增长 */ /** 开始 菜单ID,主键,自增长 */
private Long idStart; private Long idStart;
...@@ -141,6 +141,9 @@ public class MenuQuery extends MenuEntity { ...@@ -141,6 +141,9 @@ public class MenuQuery extends MenuEntity {
/** 创建用户名称 */ /** 创建用户名称 */
private List<String> createUserNameList; private List<String> createUserNameList;
/** 描述备注 */
private List<String> remarkList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<MenuQuery> orConditionList; private List<MenuQuery> orConditionList;
...@@ -847,6 +850,21 @@ public class MenuQuery extends MenuEntity { ...@@ -847,6 +850,21 @@ public class MenuQuery extends MenuEntity {
public void setCreateUserNameList(List<String> createUserNameList){ public void setCreateUserNameList(List<String> createUserNameList){
this.createUserNameList = createUserNameList; this.createUserNameList = createUserNameList;
} }
/**
* 获取 描述备注
* @return remarkList
*/
public List<String> getRemarkList(){
return this.remarkList;
}
/**
* 设置 描述备注
* @param remarkList
*/
public void setRemarkList(List<String> remarkList){
this.remarkList = remarkList;
}
/** /**
* 设置 菜单ID,主键,自增长 * 设置 菜单ID,主键,自增长
* @param id * @param id
...@@ -1367,6 +1385,25 @@ public class MenuQuery extends MenuEntity { ...@@ -1367,6 +1385,25 @@ public class MenuQuery extends MenuEntity {
return this; return this;
} }
/**
* 设置 描述备注
* @param remark
*/
public MenuQuery remark(String remark){
setRemark(remark);
return this;
}
/**
* 设置 描述备注
* @param remarkList
*/
public MenuQuery remarkList(List<String> remarkList){
this.remarkList = remarkList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
...@@ -18,6 +18,7 @@ import com.mortals.xhx.feign.rsp.ApiResp; ...@@ -18,6 +18,7 @@ import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.module.menu.model.MenuQuery; import com.mortals.xhx.module.menu.model.MenuQuery;
import com.mortals.xhx.module.menu.model.vo.MenuNodeVO; import com.mortals.xhx.module.menu.model.vo.MenuNodeVO;
import com.mortals.xhx.module.role.service.RoleModelService; import com.mortals.xhx.module.role.service.RoleModelService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......
package com.mortals.xhx.module.role.web; package com.mortals.xhx.module.role.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.param.service.ParamService; import com.mortals.xhx.module.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -51,9 +52,13 @@ public class RoleController extends BaseCRUDJsonBodyMappingController<RoleServic ...@@ -51,9 +52,13 @@ public class RoleController extends BaseCRUDJsonBodyMappingController<RoleServic
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "roleType", paramService.getParamBySecondOrganize("Role", "roleType")); //this.addDict(model, "roleType", paramService.getParamBySecondOrganize("Role", "roleType"));
super.init(model, context); super.init(model, context);
} }
@Override
protected void saveBefore(RoleEntity entity, Map<String, Object> model, Context context) throws AppException {
entity.setRoleType(1);
entity.setStatus(1);
}
} }
\ No newline at end of file
...@@ -54,6 +54,9 @@ public class UserVo extends BaseEntityLong { ...@@ -54,6 +54,9 @@ public class UserVo extends BaseEntityLong {
/** 查询条件 */ /** 查询条件 */
private String query; private String query;
private String oldPwd;
private String newPwd;
public static void main(String[] args) { public static void main(String[] args) {
UserQuery userEntity = new UserQuery(); UserQuery userEntity = new UserQuery();
......
...@@ -160,10 +160,10 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -160,10 +160,10 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@RequestMapping(value = "change/password", method = RequestMethod.POST) @RequestMapping(value = "change/password", method = RequestMethod.POST)
public String changePassword(@RequestParam String oldPwd, @RequestParam String newPwd) { public String changePassword(@RequestBody UserEntity entity) {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
try { try {
service.updateUserPwd(super.getCurUser().getLoginName(), oldPwd, newPwd); service.updateUserPwd(super.getCurUser().getLoginName(), entity.getOldPwd(), entity.getNewPwd());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "密码修改成功!"); ret.put(KEY_RESULT_MSG, "密码修改成功!");
} catch (Exception e) { } catch (Exception e) {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd"> "mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.menu.dao.ibatis.MenuDaoImpl"> <mapper namespace="com.mortals.xhx.module.menu.dao.ibatis.MenuDaoImpl">
<!-- 字段和属性映射 --> <!-- 字段和属性映射 -->
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" /> <result property="createUserId" column="createUserId" />
<result property="createUserName" column="createUserName" /> <result property="createUserName" column="createUserName" />
<result property="remark" column="remark" />
</resultMap> </resultMap>
...@@ -76,23 +77,26 @@ ...@@ -76,23 +77,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserName') or colPickMode == 1 and data.containsKey('createUserName')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserName') or colPickMode == 1 and data.containsKey('createUserName')))">
a.createUserName, a.createUserName,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
a.remark,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="MenuEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="MenuEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_menu insert into mortals_xhx_menu
(name,url,parentId,linkType,imgPath,buttonImgPath,imgCommPath,visible,menuType,status,authType,orderId,createTime,createUserId,createUserName) (name,url,parentId,linkType,imgPath,buttonImgPath,imgCommPath,visible,menuType,status,authType,orderId,createTime,createUserId,createUserName,remark)
VALUES VALUES
(#{name},#{url},#{parentId},#{linkType},#{imgPath},#{buttonImgPath},#{imgCommPath},#{visible},#{menuType},#{status},#{authType},#{orderId},#{createTime},#{createUserId},#{createUserName}) (#{name},#{url},#{parentId},#{linkType},#{imgPath},#{buttonImgPath},#{imgCommPath},#{visible},#{menuType},#{status},#{authType},#{orderId},#{createTime},#{createUserId},#{createUserName},#{remark})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_menu insert into mortals_xhx_menu
(name,url,parentId,linkType,imgPath,buttonImgPath,imgCommPath,visible,menuType,status,authType,orderId,createTime,createUserId,createUserName) (name,url,parentId,linkType,imgPath,buttonImgPath,imgCommPath,visible,menuType,status,authType,orderId,createTime,createUserId,createUserName,remark)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.name},#{item.url},#{item.parentId},#{item.linkType},#{item.imgPath},#{item.buttonImgPath},#{item.imgCommPath},#{item.visible},#{item.menuType},#{item.status},#{item.authType},#{item.orderId},#{item.createTime},#{item.createUserId},#{item.createUserName}) (#{item.name},#{item.url},#{item.parentId},#{item.linkType},#{item.imgPath},#{item.buttonImgPath},#{item.imgCommPath},#{item.visible},#{item.menuType},#{item.status},#{item.authType},#{item.orderId},#{item.createTime},#{item.createUserId},#{item.createUserName},#{item.remark})
</foreach> </foreach>
</insert> </insert>
...@@ -171,6 +175,9 @@ ...@@ -171,6 +175,9 @@
<if test="(colPickMode==0 and data.containsKey('createUserName')) or (colPickMode==1 and !data.containsKey('createUserName'))"> <if test="(colPickMode==0 and data.containsKey('createUserName')) or (colPickMode==1 and !data.containsKey('createUserName'))">
a.createUserName=#{data.createUserName}, a.createUserName=#{data.createUserName},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
a.remark=#{data.remark},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -328,6 +335,13 @@ ...@@ -328,6 +335,13 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="remark=(case" suffix="ELSE remark end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('remark')) or (colPickMode==1 and !item.containsKey('remark'))">
when a.id=#{item.id} then #{item.remark}
</if>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -723,6 +737,21 @@ ...@@ -723,6 +737,21 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('remark')">
<if test="conditionParamRef.remark != null and conditionParamRef.remark != ''">
${_conditionType_} a.remark like #{${_conditionParam_}.remark}
</if>
<if test="conditionParamRef.remark == null">
${_conditionType_} a.remark is null
</if>
</if>
<if test="conditionParamRef.containsKey('remarkList')">
${_conditionType_} a.remark in
<foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -816,6 +845,11 @@ ...@@ -816,6 +845,11 @@
<if test='orderCol.createUserName != null and "DESC".equalsIgnoreCase(orderCol.createUserName)'>DESC</if> <if test='orderCol.createUserName != null and "DESC".equalsIgnoreCase(orderCol.createUserName)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('remark')">
a.remark
<if test='orderCol.remark != null and "DESC".equalsIgnoreCase(orderCol.remark)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
</sql> </sql>
......
...@@ -15,12 +15,16 @@ ...@@ -15,12 +15,16 @@
<select id="selectMenuTreeByUserId" parameterType="paramDto" resultMap="MenuEntity-Map"> <select id="selectMenuTreeByUserId" parameterType="paramDto" resultMap="MenuEntity-Map">
select <include refid="_columns"/> select <include refid="_columns"/>
from mortals_xhx_menu a FROM (
left join mortals_xhx_role_auth rm on a.id = rm.menuId SELECT m.*
from mortals_xhx_menu m
left join mortals_xhx_role_auth rm on m.id = rm.menuId
left join mortals_xhx_role_user ur on rm.roleId = ur.roleId left join mortals_xhx_role_user ur on rm.roleId = ur.roleId
left join mortals_xhx_role ro on ur.roleId = ro.id left join mortals_xhx_role ro on ur.roleId = ro.id
left join mortals_xhx_user u on ur.userId = u.id where ur.userId = #{condition.userId} and m.menuType in ('0','1','2') and m.status = 1
where u.id = #{condition.userId} and a.menuType in ('0','1','2') and a.status = 1 AND ro.status = 1 UNION
SELECT * from mortals_xhx_menu where parentId =-1
) a
order by a.parentId, a.orderId order by a.parentId, a.orderId
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment