¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.moon.server.controller.sys; |
| | | |
| | | import com.moon.server.annotation.SysLog; |
| | | import com.moon.server.controller.all.BaseController; |
| | | import com.moon.server.entity.all.ResponseMsg; |
| | | import com.moon.server.entity.sys.ResOpEntity; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.service.sys.ResOpService; |
| | | import com.moon.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * èµæºæä½ |
| | | * @author SWS |
| | | * @date 2022-09.28 |
| | | */ |
| | | @Api(tags = "è¿ç»´ç®¡ç\\èµæºæä½") |
| | | @RestController |
| | | @RequestMapping("/resOp") |
| | | public class ResOpController extends BaseController { |
| | | @Resource |
| | | ResOpService resOpService; |
| | | |
| | | @Resource |
| | | TokenService tokenService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "èµæºåç§°", dataType = "String", paramType = "query", example = "天å°å¾"), |
| | | @ApiImplicitParam(name = "type", value = "æä½ç±»å", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "start", value = "å¼å§æ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "ç»ææ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String name, Integer type, Timestamp start, Timestamp end) { |
| | | try { |
| | | int count = resOpService.selectCount(name, type, start, end); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "èµæºåç§°", dataType = "String", paramType = "query", example = "天å°å¾"), |
| | | @ApiImplicitParam(name = "type", value = "æä½ç±»å", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "start", value = "å¼å§æ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "ç»ææ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<ResOpEntity>> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1)); |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "èµæºåç§°", dataType = "String", paramType = "query", example = "天å°å¾"), |
| | | @ApiImplicitParam(name = "type", value = "æä½ç±»å", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "start", value = "å¼å§æ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "ç»ææ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<ResOpEntity>> selectByPageAndCount(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | int count = resOpService.selectCount(name, type, start, end); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "com.lf.server.entity.sys.ResOpEntity", paramType = "body", example = "") |
| | | }) |
| | | @PostMapping(value = "/insertResOp", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertResOp(@RequestBody ResOpEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUserid(ue.getId()); |
| | | } |
| | | |
| | | int count = resOpService.insertResOp(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "List<ResOpEntity>", paramType = "body", example = "") |
| | | }) |
| | | @PostMapping(value = "/insertResOps", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertResOps(@RequestBody List<ResOpEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (ResOpEntity entity : list) { |
| | | entity.setUserid(ue.getId()); |
| | | } |
| | | } |
| | | |
| | | int count = resOpService.insertResOps(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å é¤ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteLogin") |
| | | public ResponseMsg<Integer> deleteResOp(int id) { |
| | | try { |
| | | int count = resOpService.deleteResOp(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å é¤å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "IDæ°ç»", dataType = "List<Integer>", paramType = "query", example = "1,2") |
| | | }) |
| | | @GetMapping(value = "/deleteResOps") |
| | | public ResponseMsg<Integer> deleteResOps(@RequestParam List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | int count = resOpService.deleteResOps(ids); |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "IDæ°ç»", dataType = "LoginEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateResOp", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateResOp(@RequestBody ResOpEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUserid(ue.getId()); |
| | | } |
| | | |
| | | int count = resOpService.updateResOp(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectResOp") |
| | | public ResponseMsg<ResOpEntity> selectResOp(int id) { |
| | | try { |
| | | ResOpEntity resOpEntity = resOpService.selectResOp(id); |
| | | |
| | | return success(resOpEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææ") |
| | | @GetMapping(value = "/selectResOpAll") |
| | | public ResponseMsg<List<ResOpEntity>> selectResOpAll() { |
| | | try { |
| | | List<ResOpEntity> list = resOpService.selectResOpAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.moon.server.entity.shujian; |
| | | |
| | | /** |
| | | * æ°ç®.å½±åç»æç±» |
| | | * @author WWW |
| | | * @date 2023-08-31 |
| | | */ |
| | | @SuppressWarnings("AlibabaLowerCamelCaseVariableNaming") |
| | | public class ImageResultEntity { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.moon.server.entity.sys; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * èµæºæä½ |
| | | * @author sws |
| | | * @date 2022-09-28 |
| | | */ |
| | | |
| | | public class ResOpEntity implements Serializable { |
| | | private static final long serialVersionUID = -7322438248126715583L; |
| | | |
| | | private int id; |
| | | |
| | | private String uname; |
| | | |
| | | private String name; |
| | | |
| | | private int resid; |
| | | |
| | | private int type; |
| | | |
| | | private String ip; |
| | | |
| | | private int userid; |
| | | |
| | | private Timestamp optime; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUname() { |
| | | return uname; |
| | | } |
| | | |
| | | public void setUname(String uname) { |
| | | this.uname = uname; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getResid() { |
| | | return resid; |
| | | } |
| | | |
| | | public void setResid(int resid) { |
| | | this.resid = resid; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public int getUserid() { |
| | | return userid; |
| | | } |
| | | |
| | | public void setUserid(int userid) { |
| | | this.userid = userid; |
| | | } |
| | | |
| | | public Timestamp getOptime() { |
| | | return optime; |
| | | } |
| | | |
| | | public void setOptime(Timestamp optime) { |
| | | this.optime = optime; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.moon.server.mapper.sys; |
| | | |
| | | import com.moon.server.entity.sys.ResOpEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * èµæºæä½ |
| | | * @author sws |
| | | * @date 2022-09-28 |
| | | */ |
| | | @Mapper |
| | | @ResponseBody |
| | | public interface ResOpMapper { |
| | | /** |
| | | * æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param name |
| | | * @param type |
| | | * @param start |
| | | * @param end |
| | | * @return |
| | | */ |
| | | public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param name |
| | | * @param type |
| | | * @param start |
| | | * @param end |
| | | * @param limit |
| | | * @param offset |
| | | * @return |
| | | */ |
| | | public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ |
| | | * |
| | | * @param resOpEntity |
| | | * @return |
| | | */ |
| | | public Integer insertResOp(ResOpEntity resOpEntity); |
| | | |
| | | /** |
| | | * æå
¥å¤æ¡ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public Integer insertResOps(List<ResOpEntity> list); |
| | | |
| | | /** |
| | | * å é¤ä¸æ¡ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer deleteResOp(int id); |
| | | |
| | | /** |
| | | * å é¤å¤æ¡ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deleteResOps(List<Integer> ids); |
| | | |
| | | /** |
| | | * æ´æ°ä¸æ¡ |
| | | * |
| | | * @param resOpEntity |
| | | * @return |
| | | */ |
| | | public Integer updateResOp(ResOpEntity resOpEntity); |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ¡æ°æ® |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public ResOpEntity selectResOp(int id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ |
| | | * |
| | | * @return |
| | | */ |
| | | public List<ResOpEntity> selectResOpAll(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.moon.server.service.sys; |
| | | |
| | | import com.moon.server.entity.sys.ResOpEntity; |
| | | import com.moon.server.helper.StringHelper; |
| | | import com.moon.server.mapper.sys.ResOpMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * èµæºæä½è¡¨ |
| | | * @author sws |
| | | * @date 2022-09-28 |
| | | */ |
| | | @Service |
| | | public class ResOpService implements ResOpMapper { |
| | | @Autowired |
| | | ResOpMapper resOpMapper; |
| | | |
| | | @Override |
| | | public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return resOpMapper.selectCount(name, type, start, end); |
| | | } |
| | | |
| | | @Override |
| | | public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return resOpMapper.selectByPage(name, type, start, end, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertResOp(ResOpEntity resOpEntity) { |
| | | return resOpMapper.insertResOp(resOpEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertResOps(List<ResOpEntity> resOpEntity) { |
| | | return resOpMapper.insertResOps(resOpEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteResOp(int id) { |
| | | return resOpMapper.deleteResOp(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteResOps(List<Integer> ids) { |
| | | return resOpMapper.deleteResOps(ids); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateResOp(ResOpEntity resOpEntity) { |
| | | return resOpMapper.updateResOp(resOpEntity); |
| | | } |
| | | |
| | | @Override |
| | | public ResOpEntity selectResOp(int id) { |
| | | return resOpMapper.selectResOp(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ResOpEntity> selectResOpAll() { |
| | | return resOpMapper.selectResOpAll(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.moon.server.mapper.sys.ResOpMapper"> |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | and upper(c.cn_name) like #{name} |
| | | </if> |
| | | <if test="type != null"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="start != null"> |
| | | and a.optime >= #{start} |
| | | </if> |
| | | <if test="end != null"> |
| | | and a.optime <= #{end} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.moon.server.entity.sys.ResOpEntity"> |
| | | select a.*, b.uname, c.cn_name "name" |
| | | from lf.sys_res_op a |
| | | inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | and upper(c.cn_name) like #{name} |
| | | </if> |
| | | <if test="type != null"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="start != null"> |
| | | and a.optime >= #{start} |
| | | </if> |
| | | <if test="end != null"> |
| | | and a.optime <= #{end} |
| | | </if> |
| | | </where> |
| | | order by a.id desc |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectResOpAll" resultType="com.moon.server.entity.sys.ResOpEntity"> |
| | | select * from lf.sys_res_op order by id desc; |
| | | </select> |
| | | |
| | | <select id="selectResOp" resultType="com.moon.server.entity.sys.ResOpEntity"> |
| | | select * from lf.sys_res_op where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertResOp" parameterType="com.moon.server.entity.sys.ResOpEntity"> |
| | | insert into lf.sys_res_op |
| | | (resid,type,ip,userid,optime) |
| | | values |
| | | (#{resid},#{type},#{ip},#{userid},now()); |
| | | </insert> |
| | | |
| | | <insert id="insertResOps"> |
| | | insert into lf.sys_res_op |
| | | (resid,type,ip,userid,optime) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator="," > |
| | | (#{item.resid},#{item.type},#{item.ip},#{item.userid},now()); |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <delete id="deleteResOp"> |
| | | delete from lf.sys_res_op where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteResOps"> |
| | | delete from lf.sys_res_op where id in |
| | | <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="updateResOp"> |
| | | update lf.sys_res_op set resid=#{resid},type=#{type},ip=#{ip},userid=#{userid},optime=now() where id=#{id} |
| | | </update> |
| | | </mapper> |