Commit efe45570 by tangzhaoqian Committed by chenzg

组织管理-权限管理-重构

parent 08119240
package cn.timer.api.bean.zzgl;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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 Tang 2020-05-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("菜单权限表")
public class ZzglMenu extends Model<ZzglMenu> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="菜单ID",example="101")
private Integer menuId;
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
@ApiModelProperty(value="菜单名称 ",example="菜单名称")
private String menuName;
@ApiModelProperty(value="父菜单ID",example="7777")
@NotNull(message = "父菜单ID不能为空")
private Integer parentId;
@NotBlank(message = "显示顺序不能为空")
@ApiModelProperty(value="显示顺序",example="1")
private Integer orderNum;
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
@ApiModelProperty(value="路由地址 ",example="user/ppt")
private String path;
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
@ApiModelProperty(value="组件路径 ",example="123456")
private String component;
@ApiModelProperty(value="是否为外链(0是 1否)",example="101")
private Integer isFrame;
@NotBlank(message = "菜单类型不能为空")
@ApiModelProperty(value="菜单类型(M目录 C菜单 F按钮)",example="F")
private String menuType;
@ApiModelProperty(value="菜单状态(0显示 1隐藏)",example="0")
private String visible;
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
@ApiModelProperty(value="权限标识 ",example="user:gen:code")
private String perms;
@ApiModelProperty(value="菜单图标 ",example="#")
private String icon;
@ApiModelProperty(value="创建者 ",example="创建者")
private String createBy;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value="创建时间 ",example="创建时间")
private Date createTime;
@ApiModelProperty(value="更新者 ",example="更新者")
private String updateBy;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value="更新时间 ",example="更新时间")
private Date updateTime;
@ApiModelProperty(value="备注 ",example="备注")
private String remark;
}
\ No newline at end of file
package cn.timer.api.bean.zzgl;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
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 Tang 2020-05-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("岗位和菜单关联表")
public class ZzglPostMenu extends Model<ZzglPostMenu> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="部门岗位ID 部门岗位ID",example="101")
private Integer bmgwId;
@ApiModelProperty(value="菜单ID 菜单ID",example="101")
private Integer menuId;
}
\ No newline at end of file
...@@ -6,10 +6,12 @@ import java.util.List; ...@@ -6,10 +6,12 @@ import java.util.List;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -34,15 +36,21 @@ import cn.timer.api.aspect.lang.enums.BusinessType; ...@@ -34,15 +36,21 @@ import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglAuth; import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.bean.zzgl.ZzglPostMenu;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface; import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper; import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper; import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
import cn.timer.api.dao.zzgl.ZzglMenuMapper;
import cn.timer.api.dao.zzgl.ZzglPostMenuMapper;
import cn.timer.api.dto.zzgl.LogDgjlsDto; import cn.timer.api.dto.zzgl.LogDgjlsDto;
import cn.timer.api.dto.zzgl.LogDgjlsQueryDto; import cn.timer.api.dto.zzgl.LogDgjlsQueryDto;
import cn.timer.api.dto.zzgl.UpEmpDeptDto; import cn.timer.api.dto.zzgl.UpEmpDeptDto;
import cn.timer.api.dto.zzgl.ZzglPostMenuDto;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -55,9 +63,15 @@ import io.swagger.annotations.ApiOperation; ...@@ -55,9 +63,15 @@ import io.swagger.annotations.ApiOperation;
public class ZzglController { public class ZzglController {
@Autowired @Autowired
ZzglBmgwMService zzglBmgwMService;
@Autowired
ZzglBmgwMMapper zzglBmgwMMapper; ZzglBmgwMMapper zzglBmgwMMapper;
@Autowired @Autowired
ZzglPostMenuMapper zzglPostMenuMapper;
@Autowired
ZzglLogDgjlMapper zzglLogDgjlMapper; ZzglLogDgjlMapper zzglLogDgjlMapper;
@Autowired @Autowired
...@@ -355,4 +369,140 @@ public class ZzglController { ...@@ -355,4 +369,140 @@ public class ZzglController {
}); });
return ResultUtil.success(); return ResultUtil.success();
} }
@Autowired
private ZzglMenuMapper zzglMenuMapper;
/**
* 获取-菜单权限列表
*
* @return
*/
@GetMapping(value = "/menu")
@ApiOperation(value = "获取-菜单权限列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<ZzglMenu>> selectMenu(@CurrentUser UserBean userBean) {
List<ZzglMenu> list = zzglMenuMapper.selectList(null);
return ResultUtil.data(list);
}
/**
* 获取-菜单权限-搜索
*
* @return
*/
// @PostMapping(value = "/querymenu")
// @ApiOperation(value = "获取-菜单权限-搜索", httpMethod = "POST", notes = "接口发布说明")
// public Result<List<Tree<String>>> queryMenu(@CurrentUser UserBean userBean,@RequestBody ZzglMenuQueryDto zzglMenuQueryDto) {
//
// List<ZzglMenu> list = zzglMenuMapper.queryList(zzglMenuQueryDto);
//
// //配置
// TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// // 自定义属性名 都要默认值的
//// treeNodeConfig.setIdKey("id");
//// treeNodeConfig.setParentIdKey("upId");
// treeNodeConfig.setNameKey("menuName");
// // 最大递归深度
//// treeNodeConfig.setDeep(10);
//
// //转换器
// List<Tree<String>> treeNodes = TreeUtil.build(list, "0", treeNodeConfig,
// (treeNode, tree) -> {
// tree.setId(Convert.toStr(treeNode.getMenuId()));
// tree.setParentId(Convert.toStr(treeNode.getParentId()));
//// tree.setWeight(treeNode.getWeight());
// tree.setName(treeNode.getMenuName());
// // 扩展属性 ...
// tree.putExtra("icon", treeNode.getIcon());
// tree.putExtra("isFrame", treeNode.getIsFrame());
// tree.putExtra("menuType", treeNode.getMenuType());
// tree.putExtra("orderNum", treeNode.getOrderNum());
// tree.putExtra("path", treeNode.getPath());
// tree.putExtra("perms", treeNode.getPerms());
// tree.putExtra("remark", treeNode.getRemark());
// tree.putExtra("visible", treeNode.getVisible());
//// tree.putExtra("other", new Object());
// });
//
// return ResultUtil.data(treeNodes);
// }
/**
* 新增-菜单权限
*
* @param 部门岗位id
* @return
*/
@PostMapping(value = "/menu")
@ApiOperation(value = "新增-菜单权限", httpMethod = "POST", notes = "接口发布说明")
public Result<List<ZzglMenu>> insertPostMenus(@Validated @RequestBody ZzglMenu zzglMenu) {
Integer conut = zzglMenuMapper.selectCount(new QueryWrapper<ZzglMenu>().lambda()
.eq(ZzglMenu::getMenuId, zzglMenu.getParentId()));
if (conut <= 0) {
return ResultUtil.error("上级权限不存在!");
}
return zzglMenu.insert() ? ResultUtil.success() : ResultUtil.error();
}
/**
* 删除-菜单权限
*
* @param 部门岗位id
* @return
*/
@DeleteMapping(value = "/menu/{id}")
@ApiOperation(value = "删除-菜单权限", httpMethod = "DELETE", notes = "接口发布说明")
public Result<List<ZzglMenu>> deletePostMenus(@Validated @RequestBody Integer id) {
return zzglMenuMapper.deleteById(id) > 0 ? ResultUtil.success() : ResultUtil.error();
}
/**
* 修改-菜单权限
*
* @param 部门岗位id
* @return
*/
@PutMapping(value = "/menu/{id}")
@ApiOperation(value = "修改-菜单权限", httpMethod = "PUT", notes = "接口发布说明")
public Result<List<ZzglMenu>> updatePostMenus(@Validated @RequestBody ZzglMenu zzglMenu) {
return zzglMenu.updateById() ? ResultUtil.success() : ResultUtil.error();
}
/**
* 获取-该岗位的菜单权限
*
* @param 部门岗位id
* @return
*/
@GetMapping(value = "/menu/{id}")
@ApiOperation(value = "获取-该岗位的菜单权限", httpMethod = "GET", notes = "接口发布说明")
public Result<List<Integer>> selectMenuByPostId(@CurrentUser UserBean userBean,@PathVariable Integer id) {
return ResultUtil.data(zzglBmgwMService.selectMenuByPostId(id));
}
/**
* 修改-该岗位的菜单权限
*
* @param 部门岗位id
* @return
*/
@PutMapping(value = "/post_menu")
@ApiOperation(value = "修改-该岗位的菜单权限", httpMethod = "PUT", notes = "接口发布说明")
public Result<List<ZzglMenu>> updatePostMenus(@CurrentUser UserBean userBean,@RequestBody ZzglPostMenuDto zzglPostMenuDto) {
Integer delCount = zzglPostMenuMapper.delete(new QueryWrapper<ZzglPostMenu>().lambda()
.eq(ZzglPostMenu::getBmgwId, zzglPostMenuDto.getId()));
Integer updateCount = zzglPostMenuMapper.insertPostMenus(zzglPostMenuDto.getId(),zzglPostMenuDto.getMenus());
return ResultUtil.success();
}
} }
...@@ -15,4 +15,6 @@ public interface ZzglBmgwMService { ...@@ -15,4 +15,6 @@ public interface ZzglBmgwMService {
void applicationTransferPosition(Integer empNum,Integer orgCode,UpEmpDeptDto upEmpDeptDto); void applicationTransferPosition(Integer empNum,Integer orgCode,UpEmpDeptDto upEmpDeptDto);
List<Integer> selectMenuByPostId(Integer id);
} }
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,9 +15,11 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp ...@@ -14,9 +15,11 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper; import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper; import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
import cn.timer.api.dao.zzgl.ZzglMenuMapper;
import cn.timer.api.dto.zzgl.UpEmpDeptDto; import cn.timer.api.dto.zzgl.UpEmpDeptDto;
/** /**
...@@ -31,6 +34,9 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService { ...@@ -31,6 +34,9 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
private ZzglBmgwMMapper zzglBmgwMMapper; private ZzglBmgwMMapper zzglBmgwMMapper;
@Autowired @Autowired
private ZzglMenuMapper zzglMenuMapper;
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper; private YgglMainEmpMapper ygglMainEmpMapper;
@Autowired @Autowired
...@@ -86,4 +92,13 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService { ...@@ -86,4 +92,13 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
ygglMainEmp.update(updateWrapper); ygglMainEmp.update(updateWrapper);
} }
@Override
public List<Integer> selectMenuByPostId(Integer id) {
List<ZzglMenu> list = zzglMenuMapper.selectMenuByPostId(id);
List<Integer> menuList = list.stream().map(ZzglMenu::getMenuId).collect(Collectors.toList());
return menuList;
}
} }
package cn.timer.api.dao.zzgl;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.dto.zzgl.ZzglMenuQueryDto;
/**
* 菜单权限表
* @author Tang 2020-05-22
*/
@Repository
public interface ZzglMenuMapper extends BaseMapper<ZzglMenu> {
List<ZzglMenu> selectMenuByPostId(Integer id);
List<ZzglMenu> queryList(@Param("obj") ZzglMenuQueryDto zzglMenuQueryDto);
}
package cn.timer.api.dao.zzgl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.zzgl.ZzglPostMenu;
/**
* 岗位和菜单关联表
* @author Tang 2020-05-22
*/
@Repository
public interface ZzglPostMenuMapper extends BaseMapper<ZzglPostMenu> {
Integer insertPostMenus(Integer id,@Param("menus") Integer[] menus);
}
package cn.timer.api.dto.zzgl;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ZzglMenuQueryDto {
private String menuName;
private String visible;
}
package cn.timer.api.dto.zzgl;
import java.util.Date;
import cn.timer.api.bean.zzgl.ZzglMenu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ZzglPostMenuDto {
@ApiModelProperty(value="岗位ID",example="岗位ID")
private Integer id;
@ApiModelProperty(value="菜单ID数组",example="菜单ID数组")
private Integer[] menus;
}
<?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.zzgl.ZzglMenuMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.zzgl.ZzglMenu" >
<result column="menu_id" property="menuId" />
<result column="menu_name" property="menuName" />
<result column="parent_id" property="parentId" />
<result column="order_num" property="orderNum" />
<result column="path" property="path" />
<result column="component" property="component" />
<result column="is_frame" property="isFrame" />
<result column="menu_type" property="menuType" />
<result column="visible" property="visible" />
<result column="perms" property="perms" />
<result column="icon" property="icon" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="remark" property="remark" />
</resultMap>
<sql id="Base_Column_List">
menu_id,
menu_name,
parent_id,
order_num,
path,
component,
is_frame,
menu_type,
visible,
perms,
icon,
create_by,
create_time,
update_by,
update_time,
remark
</sql>
<sql id="Base_Column_List_A">
a.menu_id,
a.menu_name,
a.parent_id,
a.order_num,
a.path,
a.component,
a.is_frame,
a.menu_type,
a.visible,
a.perms,
a.icon,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark
</sql>
<sql id="Base_Column_List_Alias">
menu_id ZzglMenu_menu_id,
menu_name ZzglMenu_menu_name,
parent_id ZzglMenu_parent_id,
order_num ZzglMenu_order_num,
path ZzglMenu_path,
component ZzglMenu_component,
is_frame ZzglMenu_is_frame,
menu_type ZzglMenu_menu_type,
visible ZzglMenu_visible,
perms ZzglMenu_perms,
icon ZzglMenu_icon,
create_by ZzglMenu_create_by,
create_time ZzglMenu_create_time,
update_by ZzglMenu_update_by,
update_time ZzglMenu_update_time,
remark ZzglMenu_remark
</sql>
<select id="selectMenuByPostId" resultMap="BaseResultMap">
SELECT a.menu_id
FROM zzgl_menu a
LEFT JOIN zzgl_post_menu b ON a.menu_id = b.menu_id
WHERE b.bmgw_id = #{id}
</select>
<select id="queryList" resultMap="BaseResultMap" parameterType="cn.timer.api.dto.zzgl.ZzglMenuQueryDto">
SELECT <include refid="Base_Column_List" />
FROM zzgl_menu
<where>
<if test ="null != obj.menuName and '' != obj.menuName">
and menu_name like CONCAT('%',#{obj.menuName},'%')
</if>
<if test ="null != obj.visible and '' != obj.visible">
and visible = #{obj.visible},
</if>
</where>
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.zzgl.ZzglMenu">
INSERT INTO zzgl_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != menuId'>
menu_id,
</if>
<if test ='null != menuName'>
menu_name,
</if>
<if test ='null != parentId'>
parent_id,
</if>
<if test ='null != orderNum'>
order_num,
</if>
<if test ='null != path'>
path,
</if>
<if test ='null != component'>
component,
</if>
<if test ='null != isFrame'>
is_frame,
</if>
<if test ='null != menuType'>
menu_type,
</if>
<if test ='null != visible'>
visible,
</if>
<if test ='null != perms'>
perms,
</if>
<if test ='null != icon'>
icon,
</if>
<if test ='null != createBy'>
create_by,
</if>
<if test ='null != createTime'>
create_time,
</if>
<if test ='null != updateBy'>
update_by,
</if>
<if test ='null != updateTime'>
update_time,
</if>
<if test ='null != remark'>
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != menuId'>
#{menuId},
</if>
<if test ='null != menuName'>
#{menuName},
</if>
<if test ='null != parentId'>
#{parentId},
</if>
<if test ='null != orderNum'>
#{orderNum},
</if>
<if test ='null != path'>
#{path},
</if>
<if test ='null != component'>
#{component},
</if>
<if test ='null != isFrame'>
#{isFrame},
</if>
<if test ='null != menuType'>
#{menuType},
</if>
<if test ='null != visible'>
#{visible},
</if>
<if test ='null != perms'>
#{perms},
</if>
<if test ='null != icon'>
#{icon},
</if>
<if test ='null != createBy'>
#{createBy},
</if>
<if test ='null != createTime'>
#{createTime},
</if>
<if test ='null != updateBy'>
#{updateBy},
</if>
<if test ='null != updateTime'>
#{updateTime},
</if>
<if test ='null != remark'>
#{remark}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM zzgl_menu
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.zzgl.ZzglMenu">
UPDATE zzgl_menu
<set>
<if test ='null != menuId'>menu_id = #{menuId},</if>
<if test ='null != menuName'>menu_name = #{menuName},</if>
<if test ='null != parentId'>parent_id = #{parentId},</if>
<if test ='null != orderNum'>order_num = #{orderNum},</if>
<if test ='null != path'>path = #{path},</if>
<if test ='null != component'>component = #{component},</if>
<if test ='null != isFrame'>is_frame = #{isFrame},</if>
<if test ='null != menuType'>menu_type = #{menuType},</if>
<if test ='null != visible'>visible = #{visible},</if>
<if test ='null != perms'>perms = #{perms},</if>
<if test ='null != icon'>icon = #{icon},</if>
<if test ='null != createBy'>create_by = #{createBy},</if>
<if test ='null != createTime'>create_time = #{createTime},</if>
<if test ='null != updateBy'>update_by = #{updateBy},</if>
<if test ='null != updateTime'>update_time = #{updateTime},</if>
<if test ='null != remark'>remark = #{remark}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_menu
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_menu
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM zzgl_menu
</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.zzgl.ZzglPostMenuMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.zzgl.ZzglPostMenu" >
<result column="bmgw_id" property="bmgwId" />
<result column="menu_id" property="menuId" />
</resultMap>
<sql id="Base_Column_List">
bmgw_id,
menu_id
</sql>
<sql id="Base_Column_List_Alias">
bmgw_id ZzglPostMenu_bmgw_id,
menu_id ZzglPostMenu_menu_id
</sql>
<insert id="insertPostMenus" useGeneratedKeys="true" keyColumn="id">
INSERT INTO zzgl_post_menu
(bmgw_id,menu_id)
values
<foreach item="item" index="index" collection="menus" open="" separator="," close="">
(
#{id},#{item}
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.zzgl.ZzglPostMenu">
INSERT INTO zzgl_post_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != bmgwId'>
bmgw_id,
</if>
<if test ='null != menuId'>
menu_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != bmgwId'>
#{bmgwId},
</if>
<if test ='null != menuId'>
#{menuId}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM zzgl_post_menu
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.zzgl.ZzglPostMenu">
UPDATE zzgl_post_menu
<set>
<if test ='null != bmgwId'>bmgw_id = #{bmgwId},</if>
<if test ='null != menuId'>menu_id = #{menuId}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_post_menu
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_post_menu
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM zzgl_post_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