Commit 6654f4ea authored by shiyu's avatar shiyu

后台角色管理

parent a0d72c86
...@@ -6,14 +6,12 @@ import com.wwdz.ch.db.dao.dts.DtsRoleDao; ...@@ -6,14 +6,12 @@ import com.wwdz.ch.db.dao.dts.DtsRoleDao;
import com.wwdz.ch.db.domain.Role; import com.wwdz.ch.db.domain.Role;
import com.wwdz.ch.db.domain.RoleExample; import com.wwdz.ch.db.domain.RoleExample;
import com.wwdz.ch.db.mapper.RoleMapper; import com.wwdz.ch.db.mapper.RoleMapper;
import org.codehaus.plexus.util.dag.DAG;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service @Service
public class DtsRoleDaoImpl implements DtsRoleDao { public class DtsRoleDaoImpl implements DtsRoleDao {
...@@ -64,8 +62,9 @@ public class DtsRoleDaoImpl implements DtsRoleDao { ...@@ -64,8 +62,9 @@ public class DtsRoleDaoImpl implements DtsRoleDao {
@Override @Override
public void add(Role role) { public void add(Role role) {
role.setAddTime(LocalDateTime.now()); Date now = new Date();
role.setUpdateTime(LocalDateTime.now()); role.setAddTime(now);
role.setUpdateTime(now);
roleMapper.insertSelective(role); roleMapper.insertSelective(role);
} }
...@@ -76,7 +75,7 @@ public class DtsRoleDaoImpl implements DtsRoleDao { ...@@ -76,7 +75,7 @@ public class DtsRoleDaoImpl implements DtsRoleDao {
@Override @Override
public void updateById(Role role) { public void updateById(Role role) {
role.setUpdateTime(LocalDateTime.now()); role.setUpdateTime(new Date());
roleMapper.updateByPrimaryKeySelective(role); roleMapper.updateByPrimaryKeySelective(role);
} }
......
...@@ -3,54 +3,22 @@ package com.wwdz.ch.db.mapper; ...@@ -3,54 +3,22 @@ package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.Role; import com.wwdz.ch.db.domain.Role;
import com.wwdz.ch.db.domain.RoleExample; import com.wwdz.ch.db.domain.RoleExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@Mapper
public interface RoleMapper { public interface RoleMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
long countByExample(RoleExample example); long countByExample(RoleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int deleteByExample(RoleExample example); int deleteByExample(RoleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int insert(Role record); int insert(Role record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int insertSelective(Role record); int insertSelective(Role record);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
...@@ -59,7 +27,7 @@ public interface RoleMapper { ...@@ -59,7 +27,7 @@ public interface RoleMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
...@@ -68,82 +36,46 @@ public interface RoleMapper { ...@@ -68,82 +36,46 @@ public interface RoleMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
List<Role> selectByExampleSelective(@Param("example") RoleExample example, @Param("selective") Role.Column ... selective); List<Role> selectByExampleSelective(@Param("example") RoleExample example, @Param("selective") Role.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
List<Role> selectByExample(RoleExample example); List<Role> selectByExample(RoleExample example);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
Role selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") Role.Column ... selective); Role selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") Role.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
Role selectByPrimaryKey(Integer id); Role selectByPrimaryKey(Integer id);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
Role selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted); Role selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example); int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int updateByExample(@Param("record") Role record, @Param("example") RoleExample example); int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(Role record); int updateByPrimaryKeySelective(Role record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role
*
* @mbg.generated
*/
int updateByPrimaryKey(Role record); int updateByPrimaryKey(Role record);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
...@@ -152,7 +84,7 @@ public interface RoleMapper { ...@@ -152,7 +84,7 @@ public interface RoleMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_role * This method corresponds to the database table role
* *
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wwdz.ch.db.mapper.RoleMapper"> <mapper namespace="com.wwdz.ch.db.mapper.RoleMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.Role"> <resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.Role">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="desc" jdbcType="VARCHAR" property="desc" /> <result column="desc" jdbcType="VARCHAR" property="desc" />
...@@ -15,10 +11,6 @@ ...@@ -15,10 +11,6 @@
<result column="deleted" jdbcType="BIT" property="deleted" /> <result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid"> <if test="criteria.valid">
...@@ -48,10 +40,6 @@ ...@@ -48,10 +40,6 @@
</where> </where>
</sql> </sql>
<sql id="Update_By_Example_Where_Clause"> <sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where> <where>
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid"> <if test="criteria.valid">
...@@ -81,21 +69,14 @@ ...@@ -81,21 +69,14 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, `name`, `desc`, enabled, add_time, update_time, deleted id, `name`, `desc`, enabled, add_time, update_time, deleted
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.RoleExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.RoleExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
'true' as QUERYID,
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from role from role
<if test="_parameter != null"> <if test="_parameter != null">
...@@ -112,6 +93,7 @@ ...@@ -112,6 +93,7 @@
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
select select
'true' as QUERYID,
<if test="example.distinct"> <if test="example.distinct">
distinct distinct
</if> </if>
...@@ -134,10 +116,6 @@ ...@@ -134,10 +116,6 @@
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from role from role
...@@ -149,10 +127,6 @@ ...@@ -149,10 +127,6 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from role from role
...@@ -188,28 +162,16 @@ ...@@ -188,28 +162,16 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from role delete from role
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.RoleExample"> <delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.RoleExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from role delete from role
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.Role"> <insert id="insert" parameterType="com.wwdz.ch.db.domain.Role">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
...@@ -221,10 +183,6 @@ ...@@ -221,10 +183,6 @@
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.Role"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.Role">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
...@@ -271,20 +229,12 @@ ...@@ -271,20 +229,12 @@
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.RoleExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.RoleExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from role select count(*) from role
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update role update role
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
...@@ -314,10 +264,6 @@ ...@@ -314,10 +264,6 @@
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update role update role
set id = #{record.id,jdbcType=INTEGER}, set id = #{record.id,jdbcType=INTEGER},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
...@@ -331,10 +277,6 @@ ...@@ -331,10 +277,6 @@
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.Role"> <update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.Role">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update role update role
<set> <set>
<if test="name != null"> <if test="name != null">
...@@ -359,10 +301,6 @@ ...@@ -359,10 +301,6 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.Role"> <update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.Role">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update role update role
set `name` = #{name,jdbcType=VARCHAR}, set `name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR}, `desc` = #{desc,jdbcType=VARCHAR},
...@@ -379,6 +317,7 @@ ...@@ -379,6 +317,7 @@
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
select select
'true' as QUERYID,
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from role from role
<if test="_parameter != null"> <if test="_parameter != null">
...@@ -396,6 +335,7 @@ ...@@ -396,6 +335,7 @@
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
select select
'true' as QUERYID,
<choose> <choose>
<when test="selective != null and selective.length &gt; 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
......
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