融合代码

更新:辅助字典移动到basics目录下,
              修订数据类型条件查询无效bug,
              优化无条件分页查询代码,
              配置编码自增,用户不需手动输入(app强特征作用域选着配置功能待添加)
             无上级,改为根节点,
This commit is contained in:
zhangshilin
2018-03-06 10:06:42 +08:00
parent bb27ba16db
commit fc2af8ba04
25 changed files with 193 additions and 366 deletions

View File

@@ -1,11 +1,11 @@
package com.nis.web.dao.configuration;
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.SysMenu;
import com.nis.domain.configuration.ServiceDictInfo;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -70,12 +70,18 @@ public interface ServiceDictInfoDao extends CrudDao<ServiceDictInfo> {
* @return
*/
List<ServiceDictInfo> findByItemCode(Integer itemCode);
/**
* 查询itemCode最大值
* @return
*/
Integer findMaxItemCode();
List<ServiceDictInfo> findItemDict(@Param("itemType")int itemType,@Param("isValid")int isValid);
List<ServiceDictInfo> findAllItemDict(@Param("itemType")int itemType);

View File

@@ -1,8 +1,8 @@
<?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.nis.web.dao.configuration.ServiceDictInfoDao" >
<mapper namespace="com.nis.web.dao.basics.ServiceDictInfoDao" >
<resultMap id="dictResultMap" type="com.nis.domain.configuration.ServiceDictInfo" >
<resultMap id="dictResultMap" type="com.nis.domain.basics.ServiceDictInfo" >
<id column="service_dict_id" property="serviceDictId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
@@ -13,23 +13,18 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<!-- 父id -->
<association property="parent" javaType="com.nis.domain.configuration.ServiceDictInfo">
<id column="service_dict_id" property="serviceDictId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<association property="parent" javaType="com.nis.domain.basics.ServiceDictInfo">
<id column="parent_id" property="serviceDictId" jdbcType="INTEGER" />
</association>
<!-- 创建人员 -->
<association property="serviceDictCreator" javaType="com.nis.domain.SysUser">
<id property="id" column="id"/>
<id property="id" column="creator_id"/>
<result property="loginId" column="login_id"/>
<result property="name" column="name"/>
</association>
<!-- 修改人员 -->
<association property="serviceDictEditor" javaType="com.nis.domain.SysUser">
<id property="id" column="id"/>
<id property="id" column="editor_id"/>
<result property="loginId" column="login_id"/>
<result property="name" column="name"/>
</association>
@@ -53,7 +48,7 @@
<!-- 查询顶层分页列表 (==)-->
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1 AND parent_id = 0
<if test="itemValue != null and itemValue != '' " >
@@ -84,7 +79,7 @@
</select>
<!-- 查询顶层分页列表 (!=)-->
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1 AND parent_id = 0
<if test="itemValue != null and itemValue != '' " >
@@ -128,7 +123,7 @@
</select>
<!-- 查询所有非叶子配置 -->
<select id="findAllNoLeafDictList" resultType="com.nis.domain.configuration.ServiceDictInfo" parameterType="java.lang.Integer">
<select id="findAllNoLeafDictList" resultType="com.nis.domain.basics.ServiceDictInfo" parameterType="java.lang.Integer">
SELECT
<include refid="serviceDictInfoColumns"/>
FROM service_dict_info s
@@ -137,7 +132,7 @@
<!-- 条件查询分页(==) -->
<select id="findDictSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
<select id="findDictSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="itemType != null and itemType != '' " >
@@ -169,7 +164,7 @@
</select>
<!-- 条件查询分页(!=) -->
<select id="findDictSearchListN" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
<select id="findDictSearchListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="itemCode != null and itemCode != '' " >
@@ -203,7 +198,7 @@
<!-- 根据主键查询字典详细信息 -->
<select id="getDictById" resultType="com.nis.domain.configuration.ServiceDictInfo">
<select id="getDictById" resultType="com.nis.domain.basics.ServiceDictInfo">
select
<include refid="serviceDictInfoColumns"/>
from service_dict_info s where s.service_dict_id = #{serviceDictId}
@@ -219,17 +214,20 @@
<!-- 根据itemCode查询字典对象列表 -->
<select id="findByItemCode" resultType="com.nis.domain.configuration.ServiceDictInfo">
<select id="findByItemCode" resultType="com.nis.domain.basics.ServiceDictInfo">
select
<include refid="serviceDictInfoColumns"/>
from service_dict_info s where s.item_code = #{itemCode}
</select>
<!-- 查出最大的itemCode值 -->
<select id="findMaxItemCode" resultType="java.lang.Integer">
select max(s.item_code) from service_dict_info s
</select>
<!-- 新增字典信息 -->
<insert id="insertDict" parameterType="com.nis.domain.configuration.ServiceDictInfo" useGeneratedKeys="true" keyProperty="id" >
<insert id="insertDict" parameterType="com.nis.domain.basics.ServiceDictInfo" useGeneratedKeys="true" keyProperty="id" >
insert into service_dict_info (item_type, item_code, item_value, item_desc, parent_id, is_leaf, is_valid, creator_id, create_time, editor_id, edit_time)
values ( #{itemType,jdbcType=INTEGER}, #{itemCode,jdbcType=INTEGER},
#{itemValue,jdbcType=VARCHAR}, #{itemDesc,jdbcType=VARCHAR},

View File

@@ -1,8 +1,8 @@
package com.nis.web.dao.configuration;
package com.nis.web.dao.basics;
import java.util.List;
import com.nis.domain.configuration.SysDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -69,6 +69,12 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
*/
List<SysDictInfo> getDictByParentId(Integer parentId);
/**
* 查询最大itemCode值
* @return
*/
Integer findMaxItemCode();

View File

@@ -1,8 +1,8 @@
<?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.nis.web.dao.configuration.SysDictInfoDao" >
<mapper namespace="com.nis.web.dao.basics.SysDictInfoDao" >
<resultMap id="dictResultMap" type="com.nis.domain.configuration.SysDictInfo" >
<resultMap id="dictResultMap" type="com.nis.domain.basics.SysDictInfo" >
<id column="sys_dict_id" property="sysDictId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
@@ -13,23 +13,18 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<!-- 父id -->
<association property="parent" javaType="com.nis.domain.configuration.SysDictInfo">
<id column="sys_dict_id" property="sysDictId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<association property="parent" javaType="com.nis.domain.basics.SysDictInfo">
<id column="parent_id" property="sysDictId" jdbcType="INTEGER" />
</association>
<!-- 创建人员 -->
<association property="sysDictCreator" javaType="com.nis.domain.SysUser">
<id property="id" column="id"/>
<id property="id" column="creator_id"/>
<result property="loginId" column="login_id"/>
<result property="name" column="name"/>
</association>
<!-- 修改人员 -->
<association property="sysDictEditor" javaType="com.nis.domain.SysUser">
<id property="id" column="id"/>
<id property="id" column="editor_id"/>
<result property="loginId" column="login_id"/>
<result property="name" column="name"/>
</association>
@@ -54,7 +49,7 @@
</sql>
<!-- 查询顶层分页列表 (==)-->
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.SysDictInfo">
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
SELECT * FROM sys_dict_info WHERE is_valid=1 AND parent_id = 0
<if test="itemValue != null and itemValue != '' " >
@@ -94,7 +89,7 @@
</select>
<!-- 条件查询分页(==) -->
<select id="findDictSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.SysDictInfo">
<select id="findDictSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
SELECT * FROM sys_dict_info WHERE is_valid=1
<if test="itemType != null and itemType != '' " >
@@ -127,7 +122,7 @@
<!-- 根据主键查询字典详细信息 -->
<select id="getDictById" resultType="com.nis.domain.configuration.SysDictInfo">
<select id="getDictById" resultType="com.nis.domain.basics.SysDictInfo">
select
<include refid="sysDictInfoColumns"/>
from sys_dict_info s where s.sys_dict_id = #{sysDictId}
@@ -135,7 +130,7 @@
<!-- 新增字典信息 -->
<insert id="insertDict" parameterType="com.nis.domain.configuration.SysDictInfo" useGeneratedKeys="true" keyProperty="id" >
<insert id="insertDict" parameterType="com.nis.domain.basics.SysDictInfo" useGeneratedKeys="true" keyProperty="id" >
insert into sys_dict_info (item_type, item_code, item_value, item_desc, parent_id, is_leaf, is_valid, creator_id, create_time, editor_id, edit_time)
values ( #{itemType,jdbcType=INTEGER}, #{itemCode,jdbcType=INTEGER},
#{itemValue,jdbcType=VARCHAR}, #{itemDesc,jdbcType=VARCHAR},
@@ -147,7 +142,7 @@
<!-- 查询所有非叶子配置 -->
<select id="findAllNoLeafDictList" resultType="com.nis.domain.configuration.SysDictInfo" parameterType="java.lang.Integer">
<select id="findAllNoLeafDictList" resultType="com.nis.domain.basics.SysDictInfo" parameterType="java.lang.Integer">
SELECT
<include refid="sysDictInfoColumns"/>
FROM sys_dict_info s
@@ -179,7 +174,7 @@
<!-- 根据itemCode查询字典对象列表 -->
<select id="findByItemCode" resultType="com.nis.domain.configuration.SysDictInfo">
<select id="findByItemCode" resultType="com.nis.domain.basics.SysDictInfo">
select
<include refid="sysDictInfoColumns"/>
from sys_dict_info s where s.item_code = #{itemCode}
@@ -192,5 +187,9 @@
from sys_dict_info s where parent_id = #{parentId}
</select>
<!-- 查询最大itemCode值 -->
<select id="findMaxItemCode" resultType="java.lang.Integer">
select max(s.item_code) from sys_dict_info s
</select>
</mapper>