修改实体类User_log get/set方法和相关引用,更新其他接口API
| | |
| | | User_inf uinf2 = (User_inf) ActionUtil.getUser(); |
| | | if(uinf!=null){ |
| | | log.setuId(uinf2.getuId()); |
| | | log.setUOprateDay(new Date()); |
| | | log.setuOprateDay(new Date()); |
| | | log.setuOprateMsg("登录移动系统"); |
| | | log.setUOprateType(UserUtil.LOGIN); |
| | | log.setuOprateType(UserUtil.LOGIN); |
| | | log.setuTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | logservice.add(log); |
| | | } |
| | |
| | | User_logService logservice= new User_logService(); |
| | | User_log log = new User_log(); |
| | | log.setuId(user.getuId()); |
| | | log.setUOprateDay(new Date()); |
| | | log.setuOprateDay(new Date()); |
| | | log.setuOprateMsg("登出系统"); |
| | | log.setUOprateType(UserUtil.LOGOUT); |
| | | log.setuOprateType(UserUtil.LOGOUT); |
| | | log.setuTerminalIp(ActionUtil.getRequest().getLocalAddr()); |
| | | logservice.add(log); |
| | | } |
| | |
| | | User_logService logservice= new User_logService(); |
| | | User_log log = new User_log(); |
| | | log.setuId(u.getuId()); |
| | | log.setUOprateDay(new Date()); |
| | | log.setuOprateDay(new Date()); |
| | | log.setuOprateMsg("登录PC系统"); |
| | | log.setUOprateType(UserUtil.LOGIN); |
| | | log.setuOprateType(UserUtil.LOGIN); |
| | | log.setuTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | logservice.add(log); |
| | | } catch (Exception e) { |
| | |
| | | public ServiceModel checkUserPass(@RequestParam String addjson){ |
| | | User_inf user = (User_inf)ActionUtil.getUser(); |
| | | ServiceModel model = new ServiceModel(); |
| | | System.out.println("addjson = " + addjson); |
| | | if(user != null && user.getUpassword().equals(addjson)){ |
| | | model.setCode(1); |
| | | }else{ |
| | |
| | | public void setuId(Integer uId) { |
| | | this.uId = uId; |
| | | } |
| | | public Integer getUOprateType() { |
| | | |
| | | public Integer getuOprateType() { |
| | | return uOprateType; |
| | | } |
| | | public void setUOprateType(Integer uOprateType) { |
| | | |
| | | public void setuOprateType(Integer uOprateType) { |
| | | this.uOprateType = uOprateType; |
| | | } |
| | | public Date getUOprateDay() { |
| | | |
| | | public Date getuOprateDay() { |
| | | return uOprateDay; |
| | | } |
| | | public void setUOprateDay(Date uOprateDay) { |
| | | |
| | | public void setuOprateDay(Date uOprateDay) { |
| | | this.uOprateDay = uOprateDay; |
| | | } |
| | | |
| | | public Date getUOprateDay1() { |
| | | |
| | | public Date getuOprateDay1() { |
| | | return uOprateDay1; |
| | | } |
| | | public void setUOprateDay1(Date uOprateDay1) { |
| | | |
| | | public void setuOprateDay1(Date uOprateDay1) { |
| | | this.uOprateDay1 = uOprateDay1; |
| | | } |
| | | |
| | | public String getuTerminalIp() { |
| | | return uTerminalIp; |
| | | } |
| | | |
| | | public void setuTerminalIp(String uTerminalIp) { |
| | | this.uTerminalIp = uTerminalIp; |
| | | } |
| | | |
| | | public String getuOprateMsg() { |
| | | return uOprateMsg; |
| | | } |
| | | public void setuOprateMsg(String uOprateMsg) { |
| | | this.uOprateMsg = uOprateMsg; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "User_log [num=" + num + ", uId=" + uId + ", uOprateType=" |
| | | + uOprateType + ", uOprateDay=" + uOprateDay + ", uOprateDay1=" |
| | | + uOprateDay1 + ", uTerminalIp=" + uTerminalIp |
| | | + ", uOprateMsg=" + uOprateMsg + "]"; |
| | | return "User_log{" + |
| | | "num=" + num + |
| | | ", uId=" + uId + |
| | | ", uOprateType=" + uOprateType + |
| | | ", uOprateDay=" + uOprateDay + |
| | | ", uOprateDay1=" + uOprateDay1 + |
| | | ", uTerminalIp='" + uTerminalIp + '\'' + |
| | | ", uOprateMsg='" + uOprateMsg + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public static User_log CreateULog(int op_type,String msg){ |
| | | User_log ulog=new User_log(); |
| | | ulog.setuId(((User_inf)ActionUtil.getUser()).getuId()); |
| | | ulog.setUOprateType(op_type); |
| | | ulog.setUOprateDay(new Date()); |
| | | ulog.setuOprateType(op_type); |
| | | ulog.setuOprateDay(new Date()); |
| | | ulog.setuOprateMsg(msg); |
| | | ulog.setuTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | return ulog; |
| | |
| | | package com.fgkj.mapper.impl; |
| | | |
| | | import com.fgkj.dto.Batt_User_Permit; |
| | | import com.fgkj.dto.User_battgroup_baojigroup; |
| | | import com.fgkj.dto.User_inf; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public List serchinfoUname() ; |
| | | |
| | | //5.3根据uid查包机组 |
| | | public List serchByInfo(Object obj); |
| | | @Select("select distinct(baoji_group_name) " + |
| | | "from db_user.tb_user_battgroup_baojigroup,db_user.tb_user_battgroup_baojigroup_usr " + |
| | | "where tb_user_battgroup_baojigroup_usr.baoji_group_id=tb_user_battgroup_baojigroup.baoji_group_id " + |
| | | "and tb_user_battgroup_baojigroup_usr.uId=#{uId}") |
| | | public List<User_battgroup_baojigroup> serchByInfo(User_inf obj); |
| | | |
| | | //根据battgroupid查对应的包机人 |
| | | public List searchByBattGroupId(Object obj); |
| | |
| | | public List serchDepNum(Object obj); |
| | | |
| | | //修改用户密码 |
| | | public boolean updatePassword(Object obj); |
| | | @Update("update db_user.tb_user_inf set usnid=#{uSnId} , upassword=#{upassword} where uid=#{uId}") |
| | | public boolean updatePassword(User_inf obj); |
| | | |
| | | //重置用户密码 |
| | | public boolean resetPassword(Object obj); |
| | | |
| | | @Update("update db_user.tb_user_inf set usnid='${@com.fgkj.mapper.UinfDaoFactory@MR_PWD}',upassword=#{upassword} where uid=#{uId}") |
| | | public boolean resetPassword(User_inf obj); |
| | | |
| | | //根据员工信息和员工编号去匹配合适的员工 |
| | | public List searchByNameOrId(Object obj); |
| | | @Select("select SQL_CALC_FOUND_ROWS distinct(uid),uSnId,uName,uShenFenId,uEmployeeId,uTelephone,uMobilephone,uEmail,uAddr,uBirthday,uAccessionDay,uSex,uDepartment,uProTitle,uAuthority,uJobGroup,uDuties,uTasks,uBaojiusr,uNote" + |
| | | " from db_user.tb_user_inf " + |
| | | " where uName like '${uinf.uName}' or uEmployeeId like '${uinf.uEmployeeId}' " + |
| | | " order by uid limit #{pageBean.pageCurr},#{pageBean.pageSize}") |
| | | public List<User_inf> searchByNameOrId(Batt_User_Permit obj); |
| | | |
| | | //包机组重做(穿梭框)查询所有的用户 |
| | | public List searchCS_All() ; |
| | |
| | | package com.fgkj.mapper.impl; |
| | | |
| | | import com.fgkj.dto.Batt_User_Permit; |
| | | import com.fgkj.dto.User_log; |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | public List serchByCondition1(Object obj); |
| | | |
| | | //5.4用户操作记录查询(根据用户名和操作类型) |
| | | @SuppressWarnings("unchecked") |
| | | public List serchByCondition(Object obj); |
| | | public List serchByCondition(Batt_User_Permit obj); |
| | | |
| | | //0.2当前时间的操作记录 |
| | | public List serchByInfo(Object obj); |
| | | public List serchByInfo(User_log obj); |
| | | |
| | | |
| | | /*public static void main(String[] args) throws ParseException { |
| | |
| | | User_inf uinf=new User_inf(); |
| | | uinf.setuName(""); |
| | | User_log ulog=new User_log(); |
| | | ulog.setUOprateType(0); |
| | | ulog.setuOprateType(0); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date1 = sdf.parse("2016-09-01"); |
| | | Date date2 = sdf.parse("2025-01-01"); |
| | | ulog.setUOprateDay(ActionUtil.getSimpDate(date1)); |
| | | ulog.setUOprateDay1(ActionUtil.getSimpDate(date1)); |
| | | ulog.setuOprateDay(ActionUtil.getSimpDate(date1)); |
| | | ulog.setuOprateDay1(ActionUtil.getSimpDate(date1)); |
| | | |
| | | Page page=new Page(); |
| | | page.setPageCurr(1); |
| | |
| | | package com.fgkj.services; |
| | | |
| | | import com.fgkj.dto.*; |
| | | import com.fgkj.mapper.UinfDaoFactory; |
| | | import com.fgkj.mapper.impl.User_infMapper; |
| | | import com.fgkj.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | // 5.3根据uid查所在的包机组 |
| | | public ServiceModel serchByInfo(Object obj) { |
| | | model = new ServiceModel(); |
| | | public ServiceModel serchByInfo(User_inf obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | List<User_battgroup_baojigroup> list = mapper.serchByInfo(obj); |
| | | // System.out.println(list.size()); |
| | | // for(User_battgroup_baojigroup u:list){ |
| | |
| | | } |
| | | |
| | | //修改用户密码 |
| | | public ServiceModel updatePassword(Object obj){ |
| | | public ServiceModel updatePassword(User_inf obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | User_inf uinf=(User_inf) obj; |
| | | uinf.setUpassword((String)ActionUtil.EncryptionMD5(uinf.getuSnId())); |
| | | //System.out.println(uinf); |
| | |
| | | } |
| | | |
| | | //根据员工信息和员工编号去匹配合适的员工 |
| | | public ServiceModel searchByNameOrId(Object obj){ |
| | | public ServiceModel searchByNameOrId(Batt_User_Permit obj){ |
| | | PageBean pageBean = obj.getPageBean(); |
| | | int curr = (pageBean.getPageCurr() - 1) * pageBean.getPageSize(); |
| | | obj.getPageBean().setPageCurr(curr); |
| | | List<User_inf> list=mapper.searchByNameOrId(obj); |
| | | |
| | | if(list!=null&&list.size()>0){ |
| | |
| | | } |
| | | |
| | | //重置用户密码 |
| | | public ServiceModel resetPassword(Object obj){ |
| | | public ServiceModel resetPassword(User_inf obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | obj.setUpassword((String)ActionUtil.EncryptionMD5(UinfDaoFactory.MR_PWD)); |
| | | Boolean bl=mapper.resetPassword(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | |
| | | //5.4用户操作记录查询(根据用户名和操作类型) |
| | | public ServiceModel serchByCondition(Batt_User_Permit obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | PageBean pageBean = obj.getPageBean(); |
| | | int curr = (pageBean.getPageCurr() - 1) * pageBean.getPageSize(); |
| | | obj.getPageBean().setPageCurr(curr); //处理 limit 两个参数 |
| | | List<Batt_User_Permit> list = mapper.serchByCondition(obj); |
| | | // for (Batt_User_Permit b : list) { |
| | | // System.out.println(b.getUlog()); |
| | | // } |
| | | for (Batt_User_Permit b : list) { |
| | | System.out.println(b.getUlog()); |
| | | } |
| | | |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | |
| | | } |
| | | |
| | | //0.2当前时间的操作记录 |
| | | public ServiceModel serchByInfo(Object obj){ |
| | | public ServiceModel serchByInfo(User_log obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | User_log ulog=(User_log) obj; |
| | | List<Batt_User_Permit> list=mapper.serchByInfo(ulog); |
| | |
| | | Batt_User_Permit bup=new Batt_User_Permit(); |
| | | User_inf uinf=new User_inf(); |
| | | User_log ulog=new User_log(); |
| | | ulog.setUOprateType(0); |
| | | ulog.setuOprateType(0); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date1 = sdf.parse("2000-01-01"); |
| | | Date date2 = sdf.parse("2025-01-01"); |
| | | ulog.setUOprateDay(ActionUtil.getSimpDate(date1)); |
| | | ulog.setUOprateDay1(ActionUtil.getSimpDate(date2)); |
| | | ulog.setuOprateDay(ActionUtil.getSimpDate(date1)); |
| | | ulog.setuOprateDay1(ActionUtil.getSimpDate(date2)); |
| | | |
| | | PageBean pageBean =new PageBean(); |
| | | pageBean.setPageCurr(1); |
| | |
| | | license=#{license} |
| | | where uId = #{uId} |
| | | </update> |
| | | <update id="updatePassword"></update> |
| | | <update id="resetPassword"></update> |
| | | <!-- <update id="updatePassword"></update>--> |
| | | <!-- <update id="resetPassword"></update>--> |
| | | <!-- <delete id="del"></delete>--> |
| | | <select id="serchByCondition" resultType="java.util.List"></select> |
| | | <select id="serchinfoUname" resultType="java.util.List"></select> |
| | | <select id="serchByInfo" resultType="java.util.List"></select> |
| | | <!-- <select id="serchByInfo" resultType="java.util.List"></select>--> |
| | | <select id="searchByBattGroupId" resultType="java.util.List"></select> |
| | | <select id="searchUnams" resultType="java.util.List"></select> |
| | | <!--方法重载了,有问题,更新方法名--> |
| | |
| | | order by uid |
| | | </select> |
| | | <select id="serchDepNum" resultType="java.util.List"></select> |
| | | <select id="searchByNameOrId" resultType="java.util.List"></select> |
| | | <!-- <select id="searchByNameOrId" resultType="java.util.List"></select>--> |
| | | <select id="searchCS_All" resultType="java.util.List"></select> |
| | | </mapper> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.fgkj.mapper.impl.User_logMapper" > |
| | | |
| | | <resultMap id="BaseResultMap" type="Batt_User_Permit"> |
| | | <association property="uinf" javaType="User_inf"> |
| | | <result column="uName" property="uName"></result> |
| | | </association> |
| | | <association property="ulog" javaType="User_log"> |
| | | <result column="uId" property="uId"></result> |
| | | <result column="uOprateType" property="uOprateType"></result> |
| | | <result column="uOprateDay" property="uOprateDay"></result> |
| | | <result column="uTerminalIp" property="uTerminalIp"></result> |
| | | <result column="uOprateMsg" property="uOprateMsg"></result> |
| | | </association> |
| | | <association property="pageBean" javaType="Page"> |
| | | <result column="pageAll" property="pageAll"></result> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <insert id="addPro"> |
| | | insert into db_user.tb_user_log(uId,uOprateType,uOprateDay,uTerminalIp,uOprateMsg) |
| | |
| | | <delete id="del"></delete> |
| | | <!-- <select id="searchAll" resultType="java.util.List"></select>--> |
| | | <select id="serchByCondition1" resultType="java.util.List"></select> |
| | | <select id="serchByCondition" resultType="java.util.List"></select> |
| | | <select id="serchByInfo" resultType="java.util.List"></select> |
| | | <select id="serchByInfo" resultMap="BaseResultMap"> |
| | | select tb_user_log.uId, uOprateType, uOprateDay, uterminalIp, uOprateMsg, tb_user_inf.uName |
| | | from db_user.tb_user_inf, |
| | | db_user.tb_user_log |
| | | where tb_user_inf.uId = tb_user_log.uId |
| | | and (uOprateDay)<![CDATA[>=]]> (#{uOprateDay}) |
| | | and (uOprateDay)<![CDATA[<=]]> (#{uOprateDay1}) |
| | | </select> |
| | | <select id="serchByCondition" resultMap="BaseResultMap"> |
| | | select SQL_CALC_FOUND_ROWS tb_user_log.uId,uOprateType,uOprateDay,uterminalIp,uOprateMsg,tb_user_inf.uName |
| | | from db_user.tb_user_inf,db_user.tb_user_log where tb_user_inf.uId=tb_user_log.uId and tb_user_inf.uName like '%${uinf.uName}%' and |
| | | (uOprateDay)<![CDATA[>]]>(#{ulog.uOprateDay}) and (uOprateDay) <![CDATA[<]]>(#{ulog.uOprateDay1}) |
| | | <if test="ulog.uOprateType==0">and uOprateType!=#{ulog.uOprateType}</if> |
| | | <if test="ulog.uOprateType!=0">and uOprateType=#{ulog.uOprateType}</if> |
| | | ORDER BY uOprateDay DESC limit #{pageBean.pageCurr},#{pageBean.pageSize} |
| | | </select> |
| | | </mapper> |