app首页代码提交
This commit is contained in:
parent
d9e2109ddb
commit
8fbedfec49
|
|
@ -0,0 +1,60 @@
|
|||
package com.bonus.sgzb.app.controller;
|
||||
|
||||
import com.bonus.sgzb.app.domain.AppMenu;
|
||||
import com.bonus.sgzb.app.service.AppMenuService;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.log.annotation.Log;
|
||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/1/17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appMenu")
|
||||
public class AppMenuController extends BaseController {
|
||||
@Autowired
|
||||
private AppMenuService service;
|
||||
|
||||
@ApiOperation(value = "查询所有菜单")
|
||||
@Log(title = "查询所有菜单", businessType = BusinessType.QUERY)
|
||||
@GetMapping("/getAllMenu")
|
||||
public AjaxResult getAllMenu()
|
||||
{
|
||||
List<AppMenu> list = service.getAllMenu();
|
||||
return AjaxResult.success("操作成功",list);
|
||||
}
|
||||
@ApiOperation(value = "查询个人菜单")
|
||||
@Log(title = "查询个人菜单", businessType = BusinessType.QUERY)
|
||||
@GetMapping("/getMenuById")
|
||||
public AjaxResult getMenuById(@RequestParam Long userId)
|
||||
{
|
||||
List<AppMenu> list = service.getMenuById(userId);
|
||||
return AjaxResult.success("操作成功",list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增个人菜单")
|
||||
@Log(title = "新增个人菜单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addMenuById")
|
||||
public AjaxResult addMenuById(@RequestBody AppMenu bean)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return toAjax(service.addMenuById(bean.getMenuId(), userId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除个人菜单")
|
||||
@Log(title = "删除个人菜单", businessType = BusinessType.INSERT)
|
||||
@DeleteMapping("/delMenuById")
|
||||
public AjaxResult delMenuById(@RequestBody AppMenu bean)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return toAjax(service.delMenuById(bean.getMenuId(),userId));
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -23,9 +24,9 @@ public class SysNoticeController {
|
|||
|
||||
@ApiOperation(value = "查询通知公告列表")
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult getList()
|
||||
public AjaxResult getList(@RequestParam(required = false, defaultValue = "", value = "keyword") String keyword)
|
||||
{
|
||||
List<SysNotice> list = service.getList();
|
||||
List<SysNotice> list = service.getList(keyword);
|
||||
return AjaxResult.success("操作成功",list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.sgzb.app.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/1/17
|
||||
*/
|
||||
@Data
|
||||
public class AppMenu {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 图标名称
|
||||
*/
|
||||
@ApiModelProperty(value = "图标名称")
|
||||
private String iconName;
|
||||
/**
|
||||
* 图标标识
|
||||
*/
|
||||
@ApiModelProperty(value = "图标标识")
|
||||
private String iconMark;
|
||||
/**
|
||||
* 业务菜单
|
||||
*/
|
||||
@ApiModelProperty(value = "业务菜单")
|
||||
private Long pId;
|
||||
/**
|
||||
* 1首页,2工作台
|
||||
*/
|
||||
@ApiModelProperty(value = "1首页,2工作台")
|
||||
private String type;
|
||||
/**
|
||||
* 0不启用1启用
|
||||
*/
|
||||
@ApiModelProperty(value = "0不启用1启用")
|
||||
private String status;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Long orderNum;
|
||||
/**
|
||||
* 按钮ID
|
||||
*/
|
||||
@ApiModelProperty(value = "按钮ID")
|
||||
private Long menuId;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.sgzb.app.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/1/17
|
||||
*/
|
||||
@Data
|
||||
public class AppMenuVo {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 图标名称
|
||||
*/
|
||||
@ApiModelProperty(value = "图标名称")
|
||||
private String iconName;
|
||||
/**
|
||||
* 图标标识
|
||||
*/
|
||||
@ApiModelProperty(value = "图标标识")
|
||||
private String iconMark;
|
||||
/**
|
||||
* 业务菜单
|
||||
*/
|
||||
@ApiModelProperty(value = "业务菜单")
|
||||
private Long pId;
|
||||
/**
|
||||
* 1首页,2工作台
|
||||
*/
|
||||
@ApiModelProperty(value = "1首页,2工作台")
|
||||
private String type;
|
||||
/**
|
||||
* 0不启用1启用
|
||||
*/
|
||||
@ApiModelProperty(value = "0不启用1启用")
|
||||
private String status;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Long orderNum;
|
||||
/**
|
||||
* 按钮ID
|
||||
*/
|
||||
@ApiModelProperty(value = "按钮ID")
|
||||
private Long menuId;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.sgzb.app.mapper;
|
||||
|
||||
import com.bonus.sgzb.app.domain.AppMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/1/17
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppMenuMapper {
|
||||
List<AppMenu> getAllMenu();
|
||||
|
||||
List<AppMenu> getMenuById(Long userId);
|
||||
|
||||
int addMenuById(@Param("appMenuId") Long appMenuId,@Param("userId") Long userId);
|
||||
|
||||
int delMenuById(@Param("appMenuId") Long appMenuId, @Param("userId")Long userId);
|
||||
}
|
||||
|
|
@ -11,5 +11,5 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysNoticeMapper {
|
||||
List<SysNotice> getList();
|
||||
List<SysNotice> getList(String keyword);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.sgzb.app.service;
|
||||
|
||||
import com.bonus.sgzb.app.domain.AppMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/1/17
|
||||
*/
|
||||
public interface AppMenuService {
|
||||
List<AppMenu> getAllMenu();
|
||||
|
||||
List<AppMenu> getMenuById(Long userId);
|
||||
|
||||
int addMenuById(Long appMenuId, Long userId);
|
||||
|
||||
int delMenuById(Long appMenuId, Long userId);
|
||||
}
|
||||
|
|
@ -9,5 +9,5 @@ import java.util.List;
|
|||
* @date 2023/12/11
|
||||
*/
|
||||
public interface SysNoticeService {
|
||||
List<SysNotice> getList();
|
||||
List<SysNotice> getList(String keyword);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.sgzb.app.service.impl;
|
||||
|
||||
import com.bonus.sgzb.app.domain.AppMenu;
|
||||
import com.bonus.sgzb.app.mapper.AppMenuMapper;
|
||||
import com.bonus.sgzb.app.service.AppMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/1/17
|
||||
*/
|
||||
@Service
|
||||
public class AppMenuServiceImpl implements AppMenuService {
|
||||
|
||||
@Autowired
|
||||
private AppMenuMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<AppMenu> getAllMenu() {
|
||||
return mapper.getAllMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppMenu> getMenuById(Long userId) {
|
||||
return mapper.getMenuById(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addMenuById(Long appMenuId, Long userId) {
|
||||
return mapper.addMenuById(appMenuId,userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delMenuById(Long appMenuId, Long userId) {
|
||||
return mapper.delMenuById(appMenuId,userId);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,11 +19,13 @@ public class SysNoticeServiceImpl implements SysNoticeService {
|
|||
private SysNoticeMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<SysNotice> getList() {
|
||||
List<SysNotice> list = mapper.getList();
|
||||
public List<SysNotice> getList(String keyword) {
|
||||
List<SysNotice> list = mapper.getList(keyword);
|
||||
for (SysNotice bean : list){
|
||||
String noticeContent = Base64.getEncoder().encodeToString(bean.getNoticeContent());
|
||||
bean.setNoticeContentStr(noticeContent);
|
||||
if (bean.getNoticeContent() != null){
|
||||
String noticeContent = Base64.getEncoder().encodeToString(bean.getNoticeContent());
|
||||
bean.setNoticeContentStr(noticeContent);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,11 +91,23 @@ public class MaTypeController extends BaseController {
|
|||
if (level == 0 || level == 1) {
|
||||
// 查询全部等级、一级
|
||||
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null));
|
||||
List<TreeSelect> children = treeSelectList.get(0).getChildren();
|
||||
TreeSelect zero = new TreeSelect();
|
||||
zero.setLevel(2);
|
||||
zero.setId(0L);
|
||||
zero.setLabel("全部");
|
||||
zero.setParentId(0L);
|
||||
children.add(0, zero);
|
||||
return AjaxResult.success(treeSelectList);
|
||||
}
|
||||
if (level == 2) {
|
||||
// 查询二级
|
||||
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword));
|
||||
if (parentId == 0){
|
||||
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null,keyword));
|
||||
}else {
|
||||
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword));
|
||||
}
|
||||
|
||||
|
||||
// List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
|
||||
//
|
||||
|
|
@ -120,7 +132,7 @@ public class MaTypeController extends BaseController {
|
|||
if (level != 2) {
|
||||
treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null));
|
||||
// treeSelectList.removeIf(item -> item.getId() == 1L);
|
||||
List<TreeSelect> treeSelectList1 = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList());
|
||||
//List<TreeSelect> treeSelectList1 = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList());
|
||||
return AjaxResult.success(treeSelectList);
|
||||
} else {
|
||||
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword));
|
||||
|
|
|
|||
|
|
@ -30,17 +30,17 @@
|
|||
</select>
|
||||
<select id="getBackNum" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from back_apply_details
|
||||
where status = '0'
|
||||
from tm_task
|
||||
where task_type = '36' and task_status = '37' and status = '1'
|
||||
</select>
|
||||
<select id="getScrapNum" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from scrap_apply_details
|
||||
where status = '0'
|
||||
from tm_task
|
||||
where task_type = '57' and task_status = '58' and status = '1'
|
||||
</select>
|
||||
<select id="getTrialNum" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from repair_audit_details
|
||||
where status = '0'
|
||||
from tm_task
|
||||
where task_type = '45' and task_status = '46' and status = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?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.bonus.sgzb.app.mapper.AppMenuMapper">
|
||||
<insert id="addMenuById">
|
||||
insert into app_menu_user
|
||||
(menu_id,user_id)
|
||||
VALUES
|
||||
(#{appMenuId},#{userId})
|
||||
</insert>
|
||||
<delete id="delMenuById">
|
||||
delete
|
||||
from app_menu_user
|
||||
where menu_id = #{appMenuId} and user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<select id="getAllMenu" resultType="com.bonus.sgzb.app.domain.AppMenu">
|
||||
select id,
|
||||
icon_name as iconName,
|
||||
icon_mark as iconMark,
|
||||
p_id as pId,
|
||||
type as type,
|
||||
status as status,
|
||||
order_num as orderNum
|
||||
from app_menu
|
||||
where status = '1' and p_id != 0
|
||||
</select>
|
||||
<select id="getMenuById" resultType="com.bonus.sgzb.app.domain.AppMenu">
|
||||
select amu.id,
|
||||
amu.menu_id as menuId,
|
||||
am.icon_name as iconName
|
||||
from app_menu_user amu
|
||||
left join app_menu am on am.id = amu.menu_id
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -15,5 +15,10 @@
|
|||
update_time as updateTime,
|
||||
remark as remark
|
||||
from sys_notice
|
||||
where status = '0'
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and notice_title like concat('%',#{keyword},'%')
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue