Commit a8b516cb by duanhq

新增根据类型获得字典value by duanht 2019/1/23

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@16957 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 46b0405d
...@@ -12,13 +12,11 @@ import com.glsx.usercenter.pojo.GroupA; ...@@ -12,13 +12,11 @@ import com.glsx.usercenter.pojo.GroupA;
import com.glsx.usercenter.pojo.dictionary.DictionaryType; import com.glsx.usercenter.pojo.dictionary.DictionaryType;
import com.glsx.usercenter.service.DictionaryTypeService; import com.glsx.usercenter.service.DictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.glsx.common.constants.ResultObject; import com.glsx.common.constants.ResultObject;
import com.glsx.common.utils.Page; import com.glsx.common.utils.Page;
...@@ -147,4 +145,18 @@ public class DictionaryTypeController extends BaseController{ ...@@ -147,4 +145,18 @@ public class DictionaryTypeController extends BaseController{
result.put("items", list); result.put("items", list);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result);
} }
/**
* @return ResultObject
* @author duanht
* @Title: getServiceItems
* @Description: TODO 根据类型获取数据
*/
@RequestMapping(value = "/getDictDateByType", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public ResultObject getDictDateByType(String dictType) {
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(),dictionaryTypeService.getDictDateByType(dictType));
}
} }
package com.glsx.usercenter.mapper; package com.glsx.usercenter.mapper;
import com.glsx.usercenter.pojo.dictionary.DictionaryData;
import com.glsx.usercenter.pojo.dictionary.DictionaryType; import com.glsx.usercenter.pojo.dictionary.DictionaryType;
import java.util.List; import java.util.List;
...@@ -76,4 +77,15 @@ public interface DictionaryTypeMapper { ...@@ -76,4 +77,15 @@ public interface DictionaryTypeMapper {
*/ */
List<DictionaryType> list(DictionaryType dictionaryType); List<DictionaryType> list(DictionaryType dictionaryType);
/**
*
* @author zhanghj
* @Title: list
* @Description: TODO 根据类型获取数据
* @param dictType
* @return
* List<DictionaryData>
*
*/
List<DictionaryData> getDictDateByType(String dictType);
} }
...@@ -3,6 +3,7 @@ package com.glsx.usercenter.service; ...@@ -3,6 +3,7 @@ package com.glsx.usercenter.service;
import java.util.List; import java.util.List;
import com.glsx.common.utils.Page; import com.glsx.common.utils.Page;
import com.glsx.usercenter.pojo.dictionary.DictionaryData;
import com.glsx.usercenter.pojo.dictionary.DictionaryType; import com.glsx.usercenter.pojo.dictionary.DictionaryType;
...@@ -79,4 +80,16 @@ public interface DictionaryTypeService { ...@@ -79,4 +80,16 @@ public interface DictionaryTypeService {
*/ */
List<DictionaryType> list(DictionaryType dictionaryType, Page page); List<DictionaryType> list(DictionaryType dictionaryType, Page page);
/**
*
* @author zhanghj
* @Title: list
* @Description: TODO 根据类型获取数据
* @param dictType
* @return
* List<DictionaryData>
*
*/
List<DictionaryData> getDictDateByType(String dictType);
} }
<?xml version="1.0" encoding="UTF-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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.manager.mapper.DictionaryTypeMapper"> <mapper namespace="com.glsx.usercenter.mapper.DictionaryTypeMapper">
<resultMap id="baseResultMap" type="com.glsx.manager.pojo.dictionary.DictionaryType"> <resultMap id="baseResultMap" type="com.glsx.usercenter.pojo.dictionary.DictionaryType">
<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="dict_type" jdbcType="VARCHAR" property="dictType" /> <result column="dict_type" jdbcType="VARCHAR" property="dictType"/>
<result column="dict_status" jdbcType="TINYINT" property="dictStatus" /> <result column="dict_status" jdbcType="TINYINT" property="dictStatus"/>
<result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy" /> <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </resultMap>
<sql id="base_Column"> <sql id="base_Column">
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
<select id="get" parameterType="java.lang.Integer" resultMap="baseResultMap"> <select id="get" parameterType="java.lang.Integer" resultMap="baseResultMap">
select select
<include refid="base_Column" /> <include refid="base_Column"/>
from sys_dict_type from sys_dict_type
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="list" parameterType="com.glsx.manager.pojo.dictionary.DictionaryType" resultMap="baseResultMap"> <select id="list" parameterType="com.glsx.usercenter.pojo.dictionary.DictionaryType" resultMap="baseResultMap">
select select
<include refid="base_Column" /> <include refid="base_Column"/>
from sys_dict_type from sys_dict_type
<where> <where>
<if test="name != null"> <if test="name != null">
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</where> </where>
</select> </select>
<insert id="save" parameterType="com.glsx.manager.pojo.dictionary.DictionaryType" useGeneratedKeys="true"> <insert id="save" parameterType="com.glsx.usercenter.pojo.dictionary.DictionaryType" useGeneratedKeys="true">
insert into sys_dict_type insert into sys_dict_type
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null"> <if test="name != null">
...@@ -104,18 +104,29 @@ ...@@ -104,18 +104,29 @@
</insert> </insert>
<update id="update" parameterType="com.glsx.manager.pojo.dictionary.DictionaryType"> <update id="update" parameterType="com.glsx.manager.pojo.dictionary.DictionaryType">
update sys_dict_type UPDATE sys_dict_type
set name = #{name,jdbcType=VARCHAR}, SET name = #{name,jdbcType=VARCHAR},
dict_type = #{dictType,jdbcType=VARCHAR}, dict_type = #{dictType,jdbcType=VARCHAR},
dict_status = #{dictStatus,jdbcType=TINYINT}, dict_status = #{dictStatus,jdbcType=TINYINT},
remark = #{remark,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR}, update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER} WHERE id = #{id,jdbcType=INTEGER}
</update> </update>
<delete id="delete" parameterType="java.lang.Integer"> <delete id="delete" parameterType="java.lang.Integer">
delete from sys_dict_type DELETE FROM sys_dict_type
where id = #{id,jdbcType=INTEGER} WHERE id = #{id,jdbcType=INTEGER}
</delete> </delete>
<select id="getDictDateByType" parameterType="java.lang.String"
resultType="com.glsx.usercenter.pojo.dictionary.DictionaryData">
SELECT
data_value dataValue,
data_key dataKey,
sort sort
FROM sys_dict_data
WHERE dict_type = #{dictType,jdbcType=VARCHAR}
AND data_status = 1
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!