Commit 51964572 by 墨竹

feat:权限

parent 3b70e81b
package com.gic.haoban.manage.service.dao.mapper.role;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 好办小程序权限菜单(TabHaobanRoleMenu)表数据库访问层
*
* @author mozhu
* @since 2022-09-09 11:36:06
*/
public interface TabHaobanRoleMenuMapper {
/**
* 通过ID查询单条数据
*
* @param roleMenuId 主键
* @return 实例对象
*/
TabHaobanRoleMenu queryById(Long roleMenuId);
/**
* 新增数据
*
* @param tabHaobanRoleMenu 实例对象
* @return 影响行数
*/
int insert(TabHaobanRoleMenu tabHaobanRoleMenu);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanRoleMenu> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TabHaobanRoleMenu> entities);
/**
* 修改数据
*
* @param tabHaobanRoleMenu 实例对象
* @return 影响行数
*/
int update(TabHaobanRoleMenu tabHaobanRoleMenu);
/**
* 通过主键删除数据
*
* @param roleMenuId 主键
* @return 影响行数
*/
int deleteById(Long roleMenuId);
}
package com.gic.haoban.manage.service.entity.role;
import java.io.Serializable;
import java.util.Date;
/**
* 好办小程序权限菜单(TabHaobanRoleMenu)实体类
*
* @author mozhu
* @since 2022-09-09 11:36:06
*/
public class TabHaobanRoleMenu implements Serializable {
private static final long serialVersionUID = 156396006594630056L;
private Long roleMenuId;
/**
* 权限id
*/
private Long roleId;
private String wxEnterpriseId;
/**
* 菜单id
*/
private String menuCode;
/**
* 1:正常;0:删除
*/
private Integer statusFlag;
private Date createTime;
private Date updateTime;
public String getMenuCode() {
return menuCode;
}
public void setMenuCode(String menuCode) {
this.menuCode = menuCode;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getRoleMenuId() {
return roleMenuId;
}
public void setRoleMenuId(Long roleMenuId) {
this.roleMenuId = roleMenuId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
}
package com.gic.haoban.manage.service.service.role;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
/**
* 好办小程序权限菜单(TabHaobanRoleMenu)表服务接口
*
* @author mozhu
* @since 2022-09-09 11:36:06
*/
public interface HaobanRoleMenuService {
/**
* 通过ID查询单条数据
*
* @param roleMenuId 主键
* @return 实例对象
*/
TabHaobanRoleMenu queryById(Long roleMenuId);
/**
* 新增数据
*
* @param tabHaobanRoleMenu 实例对象
* @return 实例对象
*/
TabHaobanRoleMenu insert(TabHaobanRoleMenu tabHaobanRoleMenu);
/**
* 修改数据
*
* @param tabHaobanRoleMenu 实例对象
* @return 实例对象
*/
TabHaobanRoleMenu update(TabHaobanRoleMenu tabHaobanRoleMenu);
/**
* 通过主键删除数据
*
* @param roleMenuId 主键
* @return 是否成功
*/
boolean deleteById(Long roleMenuId);
}
package com.gic.haoban.manage.service.service.role.impl;
import com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMenuMapper;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
import com.gic.haoban.manage.service.service.role.HaobanRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 好办小程序权限菜单(TabHaobanRoleMenu)表服务实现类
*
* @author mozhu
* @since 2022-09-09 11:36:07
*/
@Service
public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService {
@Autowired
private TabHaobanRoleMenuMapper tabHaobanRoleMenuMapper;
/**
* 通过ID查询单条数据
*
* @param roleMenuId 主键
* @return 实例对象
*/
@Override
public TabHaobanRoleMenu queryById(Long roleMenuId) {
return this.tabHaobanRoleMenuMapper.queryById(roleMenuId);
}
/**
* 新增数据
*
* @param tabHaobanRoleMenu 实例对象
* @return 实例对象
*/
@Override
public TabHaobanRoleMenu insert(TabHaobanRoleMenu tabHaobanRoleMenu) {
this.tabHaobanRoleMenuMapper.insert(tabHaobanRoleMenu);
return tabHaobanRoleMenu;
}
/**
* 修改数据
*
* @param tabHaobanRoleMenu 实例对象
* @return 实例对象
*/
@Override
public TabHaobanRoleMenu update(TabHaobanRoleMenu tabHaobanRoleMenu) {
this.tabHaobanRoleMenuMapper.update(tabHaobanRoleMenu);
return this.queryById(tabHaobanRoleMenu.getRoleMenuId());
}
/**
* 通过主键删除数据
*
* @param roleMenuId 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long roleMenuId) {
return this.tabHaobanRoleMenuMapper.deleteById(roleMenuId) > 0;
}
}
<?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.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMenuMapper">
<resultMap type="com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu" id="TabHaobanRoleMenuMap">
<result property="roleMenuId" column="role_menu_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/>
<result property="menuCode" column="menu_code" jdbcType="VARCHAR"/>
<result property="statusFlag" column="status_flag" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
role_menu_id, role_id, wx_enterprise_id ,menu_code, status_flag, create_time, update_time
</sql>
<!--查询单个-->
<select id="queryById" resultMap="TabHaobanRoleMenuMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_role_menu
where role_menu_id = #{roleMenuId}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="roleMenuId" useGeneratedKeys="true">
insert into tab_haoban_role_menu(role_menu_id, role_id, wx_enterprise_id,menu_code, status_flag, create_time, update_time)
values ( #{roleMenuId}, #{roleId}, #{wxEnterpriseId},#{menuCode}, #{statusFlag}, #{createTime}, #{updateTime})
</insert>
<insert id="insertBatch" keyProperty="roleMenuId" useGeneratedKeys="true">
insert into tab_haoban_role_menu( role_menu_id, role_id,wx_enterprise_id,menu_code, status_flag, create_time, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleMenuId},#{entity.roleId}, #{entity.wxEnterpriseId},#{entity.menuCode}, #{entity.statusFlag}, #{entity.createTime}, #{entity.updateTime})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tab_haoban_role_menu
<set>
<if test="roleId != null">
role_id = #{roleId},
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
wx_enterprise_id = #{wxEnterpriseId},
</if>
<if test="menuCode != null and menuCode != ''">
menu_code = #{menuCode},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where role_menu_id = #{roleMenuId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tab_haoban_role_menu where role_menu_id = #{roleMenuId}
</delete>
</mapper>
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