Merge branch 'master' of http://8.140.179.55:20000/r/pms-SV
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_dt", fill = FieldFill.INSERT) |
| | | @TableField(value = "dt", fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | public Date createDt; |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 前端web界面提交的角色所属权限的id,其是一个字符串数组 |
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_dt", fill = FieldFill.INSERT) |
| | | @TableField(value = "dt", fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | public Date createDt; |
| | | public Date dt; |
| | | |
| | | ////////////////////////////////////// |
| | | // 以下不是数据库实体属性 |
| | |
| | | <result column="name" property="name" /> |
| | | <result column="disabled" property="disabled" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_dt" property="createDt" /> |
| | | <result column="dt" property="dt" /> |
| | | </resultMap> |
| | | <resultMap id="partResultMap" type="com.dy.pmsGlobal.pojoBa.BaRole"> |
| | | <result column="id" property="id" /> |
| | |
| | | |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name`, disabled, deleted,create_dt |
| | | id, `name`, disabled, deleted,dt |
| | | </sql> |
| | | |
| | | <sql id="Part_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name`, disabled,create_dt |
| | | id, `name`, disabled,dt |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="someResultMap"> |
| | |
| | | <if test="name != null and name != ''"> |
| | | r.name like concat('%', #{name}, '%') and |
| | | </if> |
| | | <if test="disable != null and disable != ''"> |
| | | r.disable =#{disabled,jdbcType=BOOLEAN} and |
| | | </if> |
| | | <if test="dt != null and dt != ''"> |
| | | DATE_FORMAT(r.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP} and |
| | | </if> |
| | | </trim> |
| | | order by id DESC |
| | | <trim prefix="limit " > |
| | |
| | | <result column="supper_admin" property="supperAdmin" /> |
| | | <result column="disabled" property="disabled" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" /> |
| | | <result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" /> |
| | | <result column="create_dt" property="createDt" /> |
| | | <result column="dt" property="dt" /> |
| | | </resultMap> |
| | | <resultMap id="partResultMap" type="com.dy.pmsGlobal.pojoBa.BaUser"> |
| | | <!--@mbg.generated--> |
| | |
| | | |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name`, phone, `password`, supper_admin, disabled, deleted,create_dt |
| | | id, `name`, phone, `password`, supper_admin, disabled, deleted,dt |
| | | </sql> |
| | | <sql id="part_Column_List"> |
| | | ${alias}.id, ${alias}.name, ${alias}.phone, ${alias}.password, ${alias}.disabled,${alias}.create_dt |
| | | ${alias}.id, ${alias}.name, ${alias}.phone, ${alias}.password, ${alias}.disabled,${alias}.dt |
| | | </sql> |
| | | <sql id="Login_Column_List"> |
| | | id, name, phone, supper_admin |
| | |
| | | bu.name like concat('%', #{name}, '%') and |
| | | </if> |
| | | <if test="phone != null and phone !=''"> |
| | | bu.phone = #{phone,jdbcType=VARCHAR} |
| | | bu.phone = #{phone,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="roleId != null"> |
| | | ur.role_id=#{roleId,jdbcType=BIGINT} |
| | | ur.role_id=#{roleId,jdbcType=BIGINT} and |
| | | </if> |
| | | <if test="disabled != null"> |
| | | bu.disabled=#{disabled,jdbcType=BOOLEAN} |
| | | </if> |
| | | </trim> |
| | | order by id DESC |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页查询日志 |
| | | * 查询日志 |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoPowerAop(power = "10100010") //登录与权限同时验证 |
| | | @Log("分页查询日志") |
| | | @Log("查询日志") |
| | | public BaseResponse<QueryResultVo<List<BaLog>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaLog>> res = sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("分页查询日志异常", e); |
| | | log.error("查询日志异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | |
| | | @AllArgsConstructor |
| | | @Builder |
| | | public class QueryVo extends QueryConditionVo { |
| | | public String name; |
| | | public String userName; |
| | | } |
| | |
| | | @Builder |
| | | public class QueryVo extends QueryConditionVo { |
| | | public String name; |
| | | public boolean disable; |
| | | public String dt; |
| | | } |
| | |
| | | /** |
| | | * 删除角色信息 |
| | | * @param id |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="delete") |
| | | @SsoPowerAop(power = "10100011") |
| | | @Log("删除角色信息") |
| | | public BaseResponse<BaRole> delete(String id,BindingResult bindingResult){ |
| | | public BaseResponse<BaRole> delete(String id){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(roleSv.delete(Long.parseLong(id))); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页查询角色信息 |
| | | * 查询角色信息 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @PostMapping(path="some") |
| | | @SsoPowerAop(power = "10100010") |
| | | @Log("分页查询角色信息") |
| | | @Log("查询角色信息") |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaRole>> list = roleSv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("分页查询角色异常", e); |
| | | log.error("查询角色异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | |
| | | public String phone; |
| | | |
| | | public Long roleId; |
| | | |
| | | public Long disabled; |
| | | } |
| | | |
| | |
| | | * @return 默认密码 |
| | | */ |
| | | @GetMapping(path = "defaultPassword") |
| | | @Log("客户端请求得到默认密码") |
| | | public BaseResponse<String> defaultPassword(){ |
| | | if(defaultTrueRandomFalsePassword){ |
| | | return BaseResponseUtils.buildSuccess(defaultPassword) ; |
| | |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | //@SsoAop() //只有登录验证,没有权限验证 |
| | | @SsoPowerAop(power = "10100010") //登录与权限同时验证 |
| | | @Log("分页查询用户") |
| | | @Log("查询用户") |
| | | public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo); |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | log.error("修改密码异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | |
| | | */ |
| | | @PostMapping(path = "login", consumes = MediaType.APPLICATION_JSON_VALUE)//前端提交json数据 |
| | | @Log("用户登录(json)") |
| | | public BaseResponse<UserVo> login(@RequestBody @Valid LoginVo vo, |
| | | HttpSession session, |
| | | BindingResult bindingResult) { |
| | | public BaseResponse<UserVo> login(@RequestBody @Valid LoginVo vo,BindingResult bindingResult, |
| | | HttpSession session) { |
| | | try { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | |
| | | /** |
| | | * 客户端请求用户登录,客户端提交form表单 |
| | | * @param vo 登录用户form表单对象 |
| | | * @param loginVo 登录用户form表单对象 |
| | | * @return 登录用户值对象 |
| | | */ |
| | | @PostMapping(path = "loginForm", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)//前端提交form表单数据 |
| | | @Log("用户登录(form)") |
| | | public BaseResponse<UserVo> loginForm(@RequestBody @Valid LoginVo vo, HttpSession session,BindingResult bindingResult){ |
| | | public BaseResponse<UserVo> loginForm(@Valid LoginVo loginVo, BindingResult bindingResult,HttpSession session){ |
| | | try{ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | // 从Session中获取保存的验证码 |
| | | String sessionCaptcha = (String) session.getAttribute("captcha"); |
| | | // 首先验证验证码 |
| | | if (vo.captcha != null && vo.captcha.equalsIgnoreCase(sessionCaptcha)) { |
| | | if (loginVo.captcha != null && loginVo.captcha.equalsIgnoreCase(sessionCaptcha)) { |
| | | session.removeAttribute("captcha"); |
| | | return this.doLogin(vo) ; |
| | | return this.doLogin(loginVo) ; |
| | | } else { |
| | | // 验证码错误,返回登录页面并显示错误信息 |
| | | return BaseResponseUtils.buildFail("验证码错误"); |