Commit 16fa6856 by ilal

提交菜单自定义

parent c43f4ff5
package cn.timer.api.bean.admin;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author LAL 2020-11-12
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "admin_menu_template")
@ApiModel("企业菜单配置")
public class AdminMenuTemplate extends Model<AdminMenuTemplate> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id id", example = "101")
private Integer id;
@ApiModelProperty(value = "父菜单ID, 0 表示第一级菜单", example = "101")
private Integer parentid;
@ApiModelProperty(value = "菜单code ", example = "菜单code")
private String menuCode;
@ApiModelProperty(value = "菜单名称 ", example = "菜单名称")
private String menuName;
@ApiModelProperty(value = "菜单排序号 菜单排序号", example = "101")
private Integer sortNumber;
@ApiModelProperty(value = "路由地址 ", example = "路由地址")
private String path;
@ApiModelProperty(value = "0:未启用;1:已启用 0:未启用;1:已启用", example = "101")
private Integer enable;
@ApiModelProperty(value = "0:不可分配;1:可分配 0:不可分配;1:可分配", example = "101")
private Integer distribution;
}
\ No newline at end of file
package cn.timer.api.bean.qyzx;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author LAL 2020-11-12
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name="qyzx_admin_menu")
@ApiModel("企业自定义菜单")
public class QyzxAdminMenu extends Model<QyzxAdminMenu> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="id id",example="101")
private Integer id;
@ApiModelProperty(value="菜单code ",example="菜单code")
private String menuCode;
@ApiModelProperty(value="菜单名称 ",example="菜单名称")
private String menuName;
@ApiModelProperty(value="菜单排序号 菜单排序号",example="101")
private Integer sortNumber;
@ApiModelProperty(value="企业组织代码 企业组织代码",example="101")
private Integer orgCode;
@ApiModelProperty(value="生成时间 生成时间",example="101")
private Long addtime;
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package cn.timer.api.bean.qyzx;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
......@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.dto.login.QysDto;
import cn.timer.api.dto.qyzx.MenuStructureDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -93,4 +94,9 @@ public class QyzxEmpLogin extends Model<QyzxEmpLogin> {
@TableField(exist = false)
private YgglMainEmp ygglMainEmp;
@TableField(exist = false)
private List<MenuStructureDto> menstr;
}
\ No newline at end of file
......@@ -40,6 +40,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.admin.AdminMenuTemplate;
import cn.timer.api.bean.jxgl.JxglBasicSetting;
import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
......@@ -49,6 +50,7 @@ import cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRules;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRulesM;
import cn.timer.api.bean.qyxx.CmsContent;
import cn.timer.api.bean.qyzx.QyzxAdminMenu;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
......@@ -75,6 +77,7 @@ import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.login.QysDto;
import cn.timer.api.dto.qyzx.EntRegisterDto;
import cn.timer.api.dto.qyzx.MenuStructureDto;
import cn.timer.api.dto.yggl.ScancodeloginparametersDto;
import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result;
......@@ -852,6 +855,45 @@ public class LoginController {
List<String> menus = new ArrayList<>();
zas.stream().forEach(o -> menus.add(o.getMenuId()));
qyzxEmpLogin1.setMenus(menus);
List<MenuStructureDto> mestrs = new ArrayList<MenuStructureDto>();
List<QyzxAdminMenu> qyme = QyzxAdminMenu.builder().build().selectList(new QueryWrapper<QyzxAdminMenu>().lambda().eq(QyzxAdminMenu::getOrgCode, qyzxEmpLogin1.getOrgId()).orderByAsc(QyzxAdminMenu::getSortNumber));
String[] zdy = new String[qyme.size()];
int i = 0;
for(QyzxAdminMenu me : qyme) {
MenuStructureDto metr = MenuStructureDto.builder().build();
metr.setMenu_code(me.getMenuCode());
metr.setMenu_name(me.getMenuName());
metr.setSort_number(me.getSortNumber());
metr.setPath("");
mestrs.add(metr);
zdy[i] = me.getMenuCode();
i++;
}
//
List<AdminMenuTemplate> adtes = AdminMenuTemplate.builder().build().selectList(new QueryWrapper<AdminMenuTemplate>().lambda().eq(AdminMenuTemplate::getEnable, 1));
for(AdminMenuTemplate adm : adtes) {
if(!ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(zdy), adm.getMenuCode())) {
if(adm.getDistribution() == 0 && qyzxEmpLogin1.getOrgId() == 3) {
MenuStructureDto metr = MenuStructureDto.builder().build();
metr.setMenu_code(adm.getMenuCode());
metr.setMenu_name(adm.getMenuName());
metr.setSort_number(adm.getSortNumber());
metr.setPath("");
mestrs.add(metr);
}else if(adm.getDistribution() == 1) {
MenuStructureDto metr = MenuStructureDto.builder().build();
metr.setMenu_code(adm.getMenuCode());
metr.setMenu_name(adm.getMenuName());
metr.setSort_number(adm.getSortNumber());
metr.setPath("");
mestrs.add(metr);
}
}
}
qyzxEmpLogin1.setMenstr(mestrs);
}
}
// 可操作企业
......
......@@ -29,6 +29,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.qyzx.QyzxAdminMenu;
import cn.timer.api.bean.qyzx.QyzxAttaFwjsb;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
......@@ -494,6 +495,23 @@ public class QyzxController {
return ResultUtil.data(pages, listOl, "操作成功!");
}
@PostMapping(value = "/menustructure")
@ApiOperation(value = "菜单结构", httpMethod = "POST", notes = "")
public Result<Object> menustructure(@CurrentUser UserBean userBean,@RequestBody QyzxAdminMenu qymu) {
QyzxAdminMenu.builder().build().delete(new QueryWrapper<QyzxAdminMenu>().lambda().eq(QyzxAdminMenu::getOrgCode, userBean.getOrgCode()));
QyzxAdminMenu meu = QyzxAdminMenu.builder().build();
meu.setMenuCode(qymu.getMenuCode());
meu.setMenuName(qymu.getMenuName());
meu.setSortNumber(qymu.getSortNumber());
meu.setOrgCode(userBean.getOrgCode());
meu.setAddtime(new Date().getTime());
return ResultUtil.data(meu, "修改成功");
}
/**
* 删除-操作日志
......
package cn.timer.api.dao.admin;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.admin.AdminMenuTemplate;
/**
* 企业菜单配置
* @author LAL 2020-11-12
*/
@Repository
public interface AdminMenuTemplateMapper extends BaseMapper<AdminMenuTemplate> {
}
package cn.timer.api.dao.qyzx;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.qyzx.QyzxAdminMenu;
/**
* 企业自定义菜单
*
* @author LAL 2020-11-12
*/
@Repository
public interface QyzxAdminMenuMapper extends BaseMapper<QyzxAdminMenu> {
}
package cn.timer.api.dto.qyzx;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MenuStructureDto {
private String menu_code;
private String menu_name;
private Integer sort_number;
private String path;
}
<?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="cn.timer.api.dao.admin.AdminMenuTemplateMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.admin.AdminMenuTemplate" >
<id column="id" property="id" />
<result column="parentid" property="parentid" />
<result column="menu_code" property="menuCode" />
<result column="menu_name" property="menuName" />
<result column="sort_number" property="sortNumber" />
<result column="path" property="path" />
<result column="enable" property="enable" />
<result column="distribution" property="distribution" />
</resultMap>
<sql id="Base_Column_List">
id,
parentid,
menu_code,
menu_name,
sort_number,
path,
enable,
distribution
</sql>
<sql id="Base_Column_List_Alias">
id AdminMenuTemplate_id,
parentId AdminMenuTemplate_parentid,
menu_code AdminMenuTemplate_menu_code,
menu_name AdminMenuTemplate_menu_name,
sort_number AdminMenuTemplate_sort_number,
path AdminMenuTemplate_path,
enable AdminMenuTemplate_enable,
distribution AdminMenuTemplate_distribution
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.admin.AdminMenuTemplate">
INSERT INTO admin_menu_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != parentId'>
parentId,
</if>
<if test ='null != menuCode'>
menu_code,
</if>
<if test ='null != menuName'>
menu_name,
</if>
<if test ='null != sortNumber'>
sort_number,
</if>
<if test ='null != path'>
path,
</if>
<if test ='null != enable'>
enable,
</if>
<if test ='null != distribution'>
distribution
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != parentId'>
#{parentId},
</if>
<if test ='null != menuCode'>
#{menuCode},
</if>
<if test ='null != menuName'>
#{menuName},
</if>
<if test ='null != sortNumber'>
#{sortNumber},
</if>
<if test ='null != path'>
#{path},
</if>
<if test ='null != enable'>
#{enable},
</if>
<if test ='null != distribution'>
#{distribution}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM admin_menu_template
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.admin.AdminMenuTemplate">
UPDATE admin_menu_template
<set>
<if test ='null != parentId'>parentId = #{parentId},</if>
<if test ='null != menuCode'>menu_code = #{menuCode},</if>
<if test ='null != menuName'>menu_name = #{menuName},</if>
<if test ='null != sortNumber'>sort_number = #{sortNumber},</if>
<if test ='null != path'>path = #{path},</if>
<if test ='null != enable'>enable = #{enable},</if>
<if test ='null != distribution'>distribution = #{distribution}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM admin_menu_template
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM admin_menu_template
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM admin_menu_template
</select>
-->
</mapper>
\ No newline at end of file
<?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="cn.timer.api.dao.qyzx.QyzxAdminMenuMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.qyzx.QyzxAdminMenu" >
<id column="id" property="id" />
<result column="menu_code" property="menuCode" />
<result column="menu_name" property="menuName" />
<result column="sort_number" property="sortNumber" />
<result column="org_code" property="orgCode" />
<result column="addtime" property="addtime" />
</resultMap>
<sql id="Base_Column_List">
id,
menu_code,
menu_name,
sort_number,
org_code,
addtime
</sql>
<sql id="Base_Column_List_Alias">
id QyzxAdminMenu_id,
menu_code QyzxAdminMenu_menu_code,
menu_name QyzxAdminMenu_menu_name,
sort_number QyzxAdminMenu_sort_number,
org_code QyzxAdminMenu_org_code,
addtime QyzxAdminMenu_addtime
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.qyzx.QyzxAdminMenu">
INSERT INTO qyzx_admin_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != menuCode'>
menu_code,
</if>
<if test ='null != menuName'>
menu_name,
</if>
<if test ='null != sortNumber'>
sort_number,
</if>
<if test ='null != orgCode'>
org_code,
</if>
<if test ='null != addtime'>
addtime
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != menuCode'>
#{menuCode},
</if>
<if test ='null != menuName'>
#{menuName},
</if>
<if test ='null != sortNumber'>
#{sortNumber},
</if>
<if test ='null != orgCode'>
#{orgCode},
</if>
<if test ='null != addtime'>
#{addtime}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM qyzx_admin_menu
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.qyzx.QyzxAdminMenu">
UPDATE qyzx_admin_menu
<set>
<if test ='null != menuCode'>menu_code = #{menuCode},</if>
<if test ='null != menuName'>menu_name = #{menuName},</if>
<if test ='null != sortNumber'>sort_number = #{sortNumber},</if>
<if test ='null != orgCode'>org_code = #{orgCode},</if>
<if test ='null != addtime'>addtime = #{addtime}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM qyzx_admin_menu
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM qyzx_admin_menu
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM qyzx_admin_menu
</select>
-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment