| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "删除多条数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "主键ID集合", dataType = "List<Integer>", paramType = "query", example = "1,2") |
| | | @ApiImplicitParam(name = "DirEntity", value = "目录实体类", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") |
| | | }) |
| | | @GetMapping(value = "/deleteDirs") |
| | | public ResponseMsg<Integer> deleteDirs(@RequestParam List<Integer> ids) { |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "更新多条数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "DirEntity", value = "主键ID集合", dataType = "DirEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateDirs", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateDirs(@RequestBody List<DirEntity> dirEntity) { |
| | | try { |
| | | int count = dirService.updateDirs(dirEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主键ID", dataType = "Integer", paramType = "query", example = "1") |
| | |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "递归查询数据") |
| | | @GetMapping(value = "/selectDirRecursive") |
| | | public ResponseMsg<List<DirEntity>> selectDirRecursive() { |
| | | try { |
| | | List<DirEntity> list = dirService.selectDirRecursive(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.sys.DepEntity; |
| | | import com.lf.server.entity.sys.MenusEntity; |
| | | import com.lf.server.service.sys.DepService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "更新多条数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "DepEntity", value = "主键ID集合", dataType = "DepEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateDeps", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateDeps(@RequestBody List<DepEntity> depEntity) { |
| | | try { |
| | | int count = depService.updateDeps(depEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主键ID", dataType = "Integer", paramType = "query", example = "1") |
| | |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | @SysLog() |
| | | @ApiOperation(value = "递归查询") |
| | | @GetMapping(value = "/selectDepRecursive") |
| | | public ResponseMsg<List<DepEntity>> selectDepRecursive() { |
| | | try { |
| | | List<DepEntity> list = depService.selectDepRecursive(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.lf.server.aspect.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.sys.MenusEntity; |
| | | import com.lf.server.service.sys.MenusService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "更新多条数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "MenusEntity", value = "主键ID集合", dataType = "MenusEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateMenus", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateMenus(@RequestBody List<MenusEntity> menusEntity) { |
| | | try { |
| | | int count = menuService.updateMenus(menusEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询字典") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "字典ID", dataType = "Integer", paramType = "query", example = "1") |
| | |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "递归查询数据") |
| | | @GetMapping(value = "/selectMenuRecursive") |
| | | public ResponseMsg<List<DirEntity>> selectMenuRecursive() { |
| | | try { |
| | | List<DirEntity> list = menuService.selectMenuRecursive(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
| | | try { |
| | | System.out.println(request.getRequestURI().toLowerCase() + "," + (handler instanceof HandlerMethod)); |
| | | |
| | | // 非方法,无需拦截 |
| | | if (!(handler instanceof HandlerMethod)) { |
| | | return true; |
| | | } |
| | | |
| | | // 无需授权 |
| | | if (noNeedAuth(request)) { |
| | | return true; |
| | | } |
| | | |
| | | String token = WebHelper.getToken(request); |
| | | if (StringHelper.isNull(token)) { |
| | | WebHelper.write2Page(response, NO_TOKEN); |
| | | return false; |
| | | } |
| | | |
| | | UsersEntity ue = tokenService.getCurrentUser(request); |
| | | if (ue == null) { |
| | | WebHelper.write2Page(response, NO_LOGIN); |
| | | return false; |
| | | } |
| | | // System.out.println(request.getRequestURI().toLowerCase() + "," + (handler instanceof HandlerMethod)); |
| | | // |
| | | // // 非方法,无需拦截 |
| | | // if (!(handler instanceof HandlerMethod)) { |
| | | // return true; |
| | | // } |
| | | // |
| | | // // 无需授权 |
| | | // if (noNeedAuth(request)) { |
| | | // return true; |
| | | // } |
| | | // |
| | | // String token = WebHelper.getToken(request); |
| | | // if (StringHelper.isNull(token)) { |
| | | // WebHelper.write2Page(response, NO_TOKEN); |
| | | // return false; |
| | | // } |
| | | // |
| | | // UsersEntity ue = tokenService.getCurrentUser(request); |
| | | // if (ue == null) { |
| | | // WebHelper.write2Page(response, NO_LOGIN); |
| | | // return false; |
| | | // } |
| | | |
| | | // 权限校验 |
| | | |
| | |
| | | public Integer updateDir(DirEntity dirEntity); |
| | | |
| | | /** |
| | | * 批量修改数据 |
| | | * @param dirEntity |
| | | * @return |
| | | */ |
| | | public Integer updateDirs(List<DirEntity> dirEntity); |
| | | |
| | | |
| | | /** |
| | | * 查询单条数据 |
| | | * @param id |
| | | * @return |
| | |
| | | */ |
| | | public List<DirEntity> selectDirAll(); |
| | | |
| | | |
| | | /** |
| | | * 递归查询 |
| | | * @return |
| | | */ |
| | | public List<DirEntity> selectDirRecursive(); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public List<DepEntity> selectDepAll(); |
| | | |
| | | /** |
| | | * 批量修改 |
| | | * @param depEntity |
| | | * @return |
| | | */ |
| | | public Integer updateDeps(List<DepEntity> depEntity); |
| | | |
| | | /** |
| | | * 递归查询 |
| | | * @return |
| | | */ |
| | | public List<DepEntity> selectDepRecursive(); |
| | | } |
| | |
| | | package com.lf.server.mapper.sys; |
| | | |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.sys.MenusEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | * @return |
| | | */ |
| | | public List<MenusEntity> selectMenuAll(); |
| | | |
| | | /** |
| | | * 批量修改 |
| | | * @param menusEntity |
| | | * @return |
| | | */ |
| | | public Integer updateMenus(List<MenusEntity> menusEntity); |
| | | |
| | | /** |
| | | * 递归查询 |
| | | * @return |
| | | */ |
| | | public List<DirEntity> selectMenuRecursive(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateDirs(List<DirEntity> dirEntity) { |
| | | return dirMapper.updateDirs(dirEntity); |
| | | } |
| | | |
| | | @Override |
| | | public DirEntity selectDir(int id) { |
| | | return dirMapper.selectDir(id); |
| | | return dirMapper.selectDir(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<DirEntity> selectDirAll() { |
| | | return dirMapper.selectDirAll(); |
| | | } |
| | | |
| | | @Override |
| | | public List<DirEntity> selectDirRecursive() { |
| | | return dirMapper.selectDirRecursive(); |
| | | } |
| | | } |
| | |
| | | return depMapper.selectDepAll(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateDeps(List<DepEntity> depEntity) { |
| | | return depMapper.updateDeps(depEntity); |
| | | } |
| | | |
| | | @Override |
| | | public List<DepEntity> selectDepRecursive() { |
| | | return depMapper.selectDepRecursive(); |
| | | } |
| | | } |
| | |
| | | package com.lf.server.service.sys; |
| | | |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.sys.MenusEntity; |
| | | import com.lf.server.mapper.sys.MenusMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return menusMapper.updateMenu(menusEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateMenus(List<MenusEntity> menusEntity) { |
| | | return menusMapper.updateMenus(menusEntity); |
| | | } |
| | | |
| | | @Override |
| | | public MenusEntity selectMenu(int id) { |
| | |
| | | public List<MenusEntity> selectMenuAll() { |
| | | return menusMapper.selectMenuAll(); |
| | | } |
| | | |
| | | @Override |
| | | public List<DirEntity> selectMenuRecursive() { |
| | | return menusMapper.selectMenuRecursive(); |
| | | } |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="selectDirAll" resultMap="resultMap" resultType="com.lf.server.entity.data.DirEntity"> |
| | | select * from lf.sys_dir order by id; |
| | | select * from lf.sys_dir order by order_num; |
| | | </select> |
| | | |
| | | <select id="selectDirRecursive" resultMap="resultMap" resultType="com.lf.server.entity.data.DirEntity"> |
| | | with recursive rs as( |
| | | select * from lf.sys_dir where name='中俄东线管道工程南段' |
| | | union |
| | | select a.* from lf.sys_dir a, rs b where a.pid=b.id |
| | | ) |
| | | select * FROM rs order by order_num; |
| | | </select> |
| | | |
| | | <insert id="insertDir" parameterType="com.lf.server.entity.data.DirEntity"> |
| | |
| | | update lf.sys_dir set pid=#{pid},name=#{name},code=#{code},descr=#{descr},level=#{level},order_num=#{orderNum}, |
| | | update_user=#{updateUser}, update_time=now(),bak=#{bak} where id=#{id} |
| | | </update> |
| | | </mapper> |
| | | |
| | | |
| | | <update id="updateDirs"> |
| | | <foreach collection="list" item="item" index="index" separator="," > |
| | | update lf.sys_dir |
| | | <set> |
| | | pid=#{item.pid},name=#{item.name},code=#{item.code},descr=#{item.descr},level=#{item.level}, |
| | | order_num=#{item.orderNum},update_user=#{item.updateUser}, update_time=now(),bak=#{item.bak} |
| | | </set> |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | |
| | | <result property="updateTime" column="update_time"></result> |
| | | </resultMap> |
| | | <select id="selectDepAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity"> |
| | | select * from lf.sys_dep order by id; |
| | | select * from lf.sys_dep order by order_num; |
| | | </select> |
| | | |
| | | <select id="selectDepRecursive" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity"> |
| | | with recursive rs as( |
| | | select * from lf.sys_dep where name='中国石油天然气管道工程有限公司' |
| | | union |
| | | select a.* from lf.sys_dep a, rs b where a.pid=b.id |
| | | ) |
| | | select * FROM rs order by order_num; |
| | | </select> |
| | | <select id="selectDep" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity"> |
| | | select * from lf.sys_dep where id = #{id} |
| | | </select> |
| | |
| | | </delete> |
| | | |
| | | <update id="updateDep"> |
| | | update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax}, |
| | | email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id} |
| | | update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax}, |
| | | email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updateDeps"> |
| | | <foreach collection="list" item="item" index="index" separator="," > |
| | | update lf.sys_menu |
| | | <set> |
| | | pid=#{item.pid},name=#{item.name},sname=#{item.sname},code=#{item.code},uncode=#{item.uncode},addr=#{item.addr},contact=#{item.contact}, |
| | | fax=#{item.fax},email=#{item.email},post=#{item.post},website=#{item.website},level=#{item.level},order_num =#{item.orderNum}, |
| | | update_user=#{item.updateUser},update_time=now(),bak=#{item.bak} |
| | | </set> |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | |
| | | <result property="updateTime" column="update_time"></result> |
| | | </resultMap> |
| | | <select id="selectMenuAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.MenusEntity"> |
| | | select * from lf.sys_menu order by id; |
| | | select * from lf.sys_menu order by order_num; |
| | | </select> |
| | | |
| | | <select id="selectMenuRecursive" resultMap="resultMap" resultType="com.lf.server.entity.sys.MenusEntity"> |
| | | with recursive rs as( |
| | | select * from lf.sys_menu where cn_name='管道基础大数据平台' |
| | | union |
| | | select a.* from lf.sys_menu a, rs b where a.pid=b.id |
| | | ) |
| | | select * FROM rs order by order_num; |
| | | </select> |
| | | |
| | | <select id="selectMenu" resultMap="resultMap" resultType="com.lf.server.entity.sys.MenusEntity"> |
| | |
| | | update lf.sys_menu set pid=#{pid},cn_name=#{cnName},en_name=#{enName},url=#{url},perms=#{perms},type=#{type},icon=#{icon},level=#{level}, |
| | | order_num=#{orderNum},is_show=#{isShow},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updateMenus"> |
| | | <foreach collection="list" item="item" index="index" separator="," > |
| | | update lf.sys_menu |
| | | <set> |
| | | pid=#{item.pid},cn_name=#{item.cnName},en_name=#{item.enName},url=#{item.url},perms=#{item.perms},type=#{item.type}, |
| | | icon=#{item.icon},level=#{item.level},order_num=#{item.orderNum},is_show=#{item.isShow},update_user=#{item.updateUser}, |
| | | update_time=now(),bak=#{item.bak} |
| | | </set> |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | |
| | | |
| | | |
| | | </mapper> |