Commit 859045c4 authored by wangyihao's avatar wangyihao

新增数据字典

parent 55ec5905
package cn.com.fqy.controller.mgt;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.BaseController;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.DataDictCat;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.service.DataDictCatService;
import cn.com.fqy.core.service.DataDictItemService;
@Controller
@RequestMapping("dataDictCat")
public class DataDictCatController extends BaseController {
@Resource
private DataDictCatService dataDictCatService;
@Resource
private DataDictItemService dataDictItemService;
/**
* 数据字典分类查询
*
* @param dataDictCat
* @param pageNo
* @param pageSize
* @return
*/
@RequestMapping("getDataDictList")
@ResponseBody
public PageFinder<DataDictCat> dataDictPageList(@ModelAttribute("DataDictCat") DataDictCat dataDictCat, @RequestParam("pageNo") int pageNo,
@RequestParam("pageSize") int pageSize) {
Query q = new Query(pageNo, pageSize, dataDictCat);
return dataDictCatService.getDataDictCatPagedList(q);
}
/**
* 数据字典分类增加
*
* @param dataDictCat
* @return
*/
@RequestMapping("addOrEditDataDictCat")
@ResponseBody
public ResultInfo<DataDictCat> addOrEditDataDictCat(@ModelAttribute("DataDictCat") DataDictCat dataDictCat,String type) {
ResultInfo<DataDictCat> resultInfo = new ResultInfo<DataDictCat>();
if (dataDictCat.getDataDictCatCode()!=null&&!"".equals(dataDictCat.getDataDictCatCode())) {
DataDictCat dtc =dataDictCatService.getDataDictCat(dataDictCat.getDataDictCatCode());
if (type.equals("add")) {
if(dtc != null){
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("分类编码重复");
return resultInfo;
}else {
resultInfo = dataDictCatService.addDataDictCat(dataDictCat, getOperator());
}
}else if(type.equals("edit")){
resultInfo = dataDictCatService.updateDataDictCat(dataDictCat, getOperator());
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("参数错误");
return resultInfo;
}
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("分类编码为空");
}
return resultInfo;
}
/**
* 数据字典分类删除
*
* @param dataDictCatCode
* @return
*/
@RequestMapping("delDataDict")
@ResponseBody
public ResultInfo<DataDictCat> delDataDict(@RequestParam("dataDictCatCode") String dataDictCatCode) {
return dataDictCatService.delDataDictCat(dataDictCatCode, getOperator());
}
/**
* 数据字典分类查询
*
* @param dataDictCat
* @param pageNo
* @param pageSize
* @return
*/
@RequestMapping("getDataDicts")
@ResponseBody
public ResultInfo<List<DataDictCat>> getDataDicts(){
ResultInfo<List<DataDictCat>> result = new ResultInfo<>();
DataDictCat dataDictCat = new DataDictCat();
dataDictCat.setIsAvailable(1);
List<DataDictCat> list = dataDictCatService.getDataDictCatList(new Query(dataDictCat));
if (list.size()>0) {
result.setCode("1");
result.setData(list);
}else {
result.setCode("0");
result.setMsg("暂无数据");
}
return result;
}
}
package cn.com.fqy.controller.mgt;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.BaseController;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.DataDictItem;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.service.DataDictCatService;
import cn.com.fqy.core.service.DataDictItemService;
@Controller
@RequestMapping("dataDictItem")
public class DataDictItemController extends BaseController {
@Resource
private DataDictCatService dataDictCatService;
@Resource
private DataDictItemService dataDictItemService;
/**
* 数据字典项查询
*
* @param dataDictCatItem
* @param pageNo
* @param pageSize
* @return
*/
@RequestMapping("getDataDictItemList")
@ResponseBody
public PageFinder<DataDictItem> dataDictItemPageList(@ModelAttribute("DataDictItem") DataDictItem dataDictCatItem, Query query) {
Query q = new Query(query.getPageNo(), query.getPageSize(), dataDictCatItem);
return dataDictItemService.getDataDictItemPagedList(q);
}
/**
*数据字典项增加编辑
*
* @param dataDictCatItem
* @return
*/
@RequestMapping("addOrEditDataDictItem")
@ResponseBody
public ResultInfo<DataDictItem> addDataDictItem(@ModelAttribute("DataDictItem") DataDictItem dataDictItem) {
ResultInfo<DataDictItem> resultInfo = new ResultInfo<DataDictItem>();
if (dataDictItem.getDataDictItemId()!=null&&!"".equals(dataDictItem.getDataDictItemId())) {
if (dataDictItem.getItemValue()!=null&&!"".equals(dataDictItem.getItemValue())) {
DataDictItem dataDictItemQuery = new DataDictItem();
dataDictItemQuery.setDataDictCatCode(dataDictItem.getDataDictCatCode());
dataDictItemQuery.setItemValue(dataDictItem.getItemValue());
Query q = new Query(dataDictItemQuery);
List<DataDictItem> dataDictItems=dataDictItemService.getDataDictItemList(q);
if(dataDictItems.size()>0 && !dataDictItems.get(0).getDataDictItemId().equals(dataDictItem.getDataDictItemId())){
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("数据字典项值有重复");
return resultInfo;
}
}
if (dataDictItem.getIsAvailable()!=null) {
dataDictItem.setAvailableUpdateTime(new Date());
}
resultInfo= dataDictItemService.updateDataDictItem(dataDictItem, getOperator());
}else {
DataDictItem dataDictItemQuery = new DataDictItem();
dataDictItemQuery.setDataDictCatCode(dataDictItem.getDataDictCatCode());
dataDictItemQuery.setItemValue(dataDictItem.getItemValue());
Query q = new Query(dataDictItemQuery);
List<DataDictItem> dataDictItems=dataDictItemService.getDataDictItemList(q);
if(dataDictItems.size()>0 ){
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("数据字典项值有重复");
return resultInfo;
}
resultInfo= dataDictItemService.addDataDictItem(dataDictItem, getOperator());
}
return resultInfo;
}
/**
* 数据字典分类查询
*
* @param dataDictCat
* @param pageNo
* @param pageSize
* @return
*/
@RequestMapping("getDataDictItems")
@ResponseBody
public ResultInfo<List<DataDictItem>> getDataDicts(){
ResultInfo<List<DataDictItem>> result = new ResultInfo<>();
DataDictItem dataDictItem = new DataDictItem();
dataDictItem.setIsAvailable(1);
dataDictItem.setIsDeleted(0);
dataDictItem.setDataDictCatCode("UES_INSTACTION");
List<DataDictItem> list = dataDictItemService.getDataDictItemList(new Query(dataDictItem));
if (list.size()>0) {
result.setCode("1");
result.setData(list);
}else {
result.setCode("0");
result.setMsg("暂无数据");
}
return result;
}
/**
* 数据字典分类查询
*
* @param dataDictCat
* @param pageNo
* @param pageSize
* @return
*/
@RequestMapping("getDataDictsBox")
@ResponseBody
public ResultInfo<List<DataDictItem>> getDataDictsBox(){
ResultInfo<List<DataDictItem>> result = new ResultInfo<>();
DataDictItem dataDictItem = new DataDictItem();
dataDictItem.setIsAvailable(1);
dataDictItem.setIsDeleted(0);
dataDictItem.setDataDictCatCode("BOX_TYPE");
List<DataDictItem> list = dataDictItemService.getDataDictItemList(new Query(dataDictItem));
if (list.size()>0) {
result.setCode("1");
result.setData(list);
}else {
result.setCode("0");
result.setMsg("暂无数据");
}
return result;
}
/**
* 数据字典项删除
*
* @param dataDictCatId
* @return
*/
@RequestMapping("delDataDictItem")
@ResponseBody
public ResultInfo<DataDictItem> delDataDictItem(@RequestParam("dataDictItemId") String dataDictItemId) {
return dataDictItemService.delDataDictItem(dataDictItemId, getOperator());
}
}
package cn.com.fqy.core.dao;
import cn.com.fqy.core.common.BaseDao;
import cn.com.fqy.core.model.DataDictCat;
/**
* 数据字典的分类表 数据库处理类
*/
public interface DataDictCatDao extends BaseDao<DataDictCat,String> {
}
package cn.com.fqy.core.dao;
import java.util.List;
import cn.com.fqy.core.common.BaseDao;
import cn.com.fqy.core.model.DataDictItem;
/**
* 数据字典的明细项表 数据库处理类
*/
public interface DataDictItemDao extends BaseDao<DataDictItem,String> {
public List<DataDictItem> getDataDictCatCode();
}
package cn.com.fqy.core.model;
import java.util.Date;
import cn.com.fqy.common.Entity;
/**
* 数据字典的分类表 数据实体类
*/
public class DataDictCat extends Entity<String> {
private static final long serialVersionUID = 1l;
/*Auto generated properties start*/
//数据字典分类代码(根据业务自定,如城市:CITY)
private String dataDictCatCode;
//数据字典分类名称
private String dataDictCatName;
//父分类代码(如果无父分类,则此字段值为null)
private String parentCatCode;
//备注
private String memo;
//是否可用(1、可用,0、不可用,默认1)
private Integer isAvailable;
//是否已删除(1、已删除,0、未删除,默认0)
private Integer isDeleted;
//创建时间
private Date createTime;
//创建时间 时间范围起(查询用)
private Date createTimeStart;
//创建时间 时间范围止(查询用)
private Date createTimeEnd;
//更新时间
private Date updateTime;
//更新时间 时间范围起(查询用)
private Date updateTimeStart;
//更新时间 时间范围止(查询用)
private Date updateTimeEnd;
////操作人类型(0、系统自动操作,1、平台人员操作,2、商家人员操作,3、会员操作)
private Integer operatorType;
//操作人id
private String operatorId;
/*Auto generated properties end*/
/*Customized properties start*/
/*Customized properties end*/
/*Auto generated methods start*/
@Override
public String getPK(){
return dataDictCatCode;
}
public String getDataDictCatCode(){
return dataDictCatCode;
}
public void setDataDictCatCode(String dataDictCatCode){
this.dataDictCatCode = dataDictCatCode;
}
public String getDataDictCatName(){
return dataDictCatName;
}
public void setDataDictCatName(String dataDictCatName){
this.dataDictCatName = dataDictCatName;
}
public String getParentCatCode(){
return parentCatCode;
}
public void setParentCatCode(String parentCatCode){
this.parentCatCode = parentCatCode;
}
public String getMemo(){
return memo;
}
public void setMemo(String memo){
this.memo = memo;
}
public Integer getIsAvailable(){
return isAvailable;
}
public void setIsAvailable(Integer isAvailable){
this.isAvailable = isAvailable;
}
public Integer getIsDeleted(){
return isDeleted;
}
public void setIsDeleted(Integer isDeleted){
this.isDeleted = isDeleted;
}
public Date getCreateTime(){
return createTime;
}
public void setCreateTime(Date createTime){
this.createTime = createTime;
}
public Date getCreateTimeStart(){
return createTimeStart;
}
public void setCreateTimeStart(Date createTimeStart){
this.createTimeStart = createTimeStart;
}
public Date getCreateTimeEnd(){
return createTimeEnd;
}
public void setCreateTimeEnd(Date createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
public Date getUpdateTime(){
return updateTime;
}
public void setUpdateTime(Date updateTime){
this.updateTime = updateTime;
}
public Date getUpdateTimeStart(){
return updateTimeStart;
}
public void setUpdateTimeStart(Date updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
public Date getUpdateTimeEnd(){
return updateTimeEnd;
}
public void setUpdateTimeEnd(Date updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
public Integer getOperatorType(){
return operatorType;
}
public void setOperatorType(Integer operatorType){
this.operatorType = operatorType;
}
public String getOperatorId(){
return operatorId;
}
public void setOperatorId(String operatorId){
this.operatorId = operatorId;
}
/*Auto generated methods end*/
/*Customized methods start*/
/*Customized methods end*/
@Override
public String toString() {
return "DataDictCat ["
+ "dataDictCatCode = " + dataDictCatCode + ", dataDictCatName = " + dataDictCatName + ", parentCatCode = " + parentCatCode + ", memo = " + memo
+ ", isAvailable = " + isAvailable + ", isDeleted = " + isDeleted + ", createTime = " + createTime + ", createTimeStart = " + createTimeStart + ", createTimeEnd = " + createTimeEnd + ", updateTime = " + updateTime + ", updateTimeStart = " + updateTimeStart + ", updateTimeEnd = " + updateTimeEnd
+ ", operatorType = " + operatorType + ", operatorId = " + operatorId
+"]";
}
}
package cn.com.fqy.core.model;
import java.util.Date;
import cn.com.fqy.common.Entity;
/**
* 数据字典的明细项表 数据实体类
*/
public class DataDictItem extends Entity<String> {
private static final long serialVersionUID = 1l;
/*Auto generated properties start*/
//数据字典项id
private String dataDictItemId;
//数据字典分类编码(如,城市:CITY)
private String dataDictCatCode;
//父级项的id
private String parentItemId;
//字典项的值
private String itemValue;
//备注
private String memo;
//是否可用(1、可用,0、不可用,默认1)
private Integer isAvailable;
//可用状态更新时间
private Date availableUpdateTime;
//可用状态更新时间 时间范围起(查询用)
private Date availableUpdateTimeStart;
//可用状态更新时间 时间范围止(查询用)
private Date availableUpdateTimeEnd;
//是否已删除(1、已删除,0、未删除,默认0)
private Integer isDeleted;
//创建时间
private Date createTime;
//创建时间 时间范围起(查询用)
private Date createTimeStart;
//创建时间 时间范围止(查询用)
private Date createTimeEnd;
//更新时间
private Date updateTime;
//更新时间 时间范围起(查询用)
private Date updateTimeStart;
//更新时间 时间范围止(查询用)
private Date updateTimeEnd;
//操作人id
private String operatorId;
//操作人类型(0、系统自动操作,1、平台人员操作,2、商家人员操作,3、会员操作)
private Integer operatorType;
/*Auto generated properties end*/
/*Customized properties start*/
/*Customized properties end*/
/*Auto generated methods start*/
@Override
public String getPK(){
return dataDictItemId;
}
public String getDataDictItemId(){
return dataDictItemId;
}
public void setDataDictItemId(String dataDictItemId){
this.dataDictItemId = dataDictItemId;
}
public String getDataDictCatCode(){
return dataDictCatCode;
}
public void setDataDictCatCode(String dataDictCatCode){
this.dataDictCatCode = dataDictCatCode;
}
public String getParentItemId(){
return parentItemId;
}
public void setParentItemId(String parentItemId){
this.parentItemId = parentItemId;
}
public String getItemValue(){
return itemValue;
}
public void setItemValue(String itemValue){
this.itemValue = itemValue;
}
public String getMemo(){
return memo;
}
public void setMemo(String memo){
this.memo = memo;
}
public Integer getIsAvailable(){
return isAvailable;
}
public void setIsAvailable(Integer isAvailable){
this.isAvailable = isAvailable;
}
public Date getAvailableUpdateTime(){
return availableUpdateTime;
}
public void setAvailableUpdateTime(Date availableUpdateTime){
this.availableUpdateTime = availableUpdateTime;
}
public Date getAvailableUpdateTimeStart(){
return availableUpdateTimeStart;
}
public void setAvailableUpdateTimeStart(Date availableUpdateTimeStart){
this.availableUpdateTimeStart = availableUpdateTimeStart;
}
public Date getAvailableUpdateTimeEnd(){
return availableUpdateTimeEnd;
}
public void setAvailableUpdateTimeEnd(Date availableUpdateTimeEnd){
this.availableUpdateTimeEnd = availableUpdateTimeEnd;
}
public Integer getIsDeleted(){
return isDeleted;
}
public void setIsDeleted(Integer isDeleted){
this.isDeleted = isDeleted;
}
public Date getCreateTime(){
return createTime;
}
public void setCreateTime(Date createTime){
this.createTime = createTime;
}
public Date getCreateTimeStart(){
return createTimeStart;
}
public void setCreateTimeStart(Date createTimeStart){
this.createTimeStart = createTimeStart;
}
public Date getCreateTimeEnd(){
return createTimeEnd;
}
public void setCreateTimeEnd(Date createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
public Date getUpdateTime(){
return updateTime;
}
public void setUpdateTime(Date updateTime){
this.updateTime = updateTime;
}
public Date getUpdateTimeStart(){
return updateTimeStart;
}
public void setUpdateTimeStart(Date updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
public Date getUpdateTimeEnd(){
return updateTimeEnd;
}
public void setUpdateTimeEnd(Date updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
public String getOperatorId(){
return operatorId;
}
public void setOperatorId(String operatorId){
this.operatorId = operatorId;
}
public Integer getOperatorType(){
return operatorType;
}
public void setOperatorType(Integer operatorType){
this.operatorType = operatorType;
}
/*Auto generated methods end*/
/*Customized methods start*/
/*Customized methods end*/
@Override
public String toString() {
return "DataDictItem ["
+ "dataDictItemId = " + dataDictItemId + ", dataDictCatCode = " + dataDictCatCode + ", parentItemId = " + parentItemId + ", itemValue = " + itemValue
+ ", memo = " + memo + ", isAvailable = " + isAvailable + ", availableUpdateTime = " + availableUpdateTime + ", availableUpdateTimeStart = " + availableUpdateTimeStart + ", availableUpdateTimeEnd = " + availableUpdateTimeEnd + ", isDeleted = " + isDeleted
+ ", createTime = " + createTime + ", createTimeStart = " + createTimeStart + ", createTimeEnd = " + createTimeEnd + ", updateTime = " + updateTime + ", updateTimeStart = " + updateTimeStart + ", updateTimeEnd = " + updateTimeEnd + ", operatorId = " + operatorId + ", operatorType = " + operatorType
+"]";
}
}
package cn.com.fqy.core.service;
import java.util.List;
import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseService;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.DataDictCat;
import cn.com.fqy.core.model.Query;
/**
* 数据字典的分类表 服务接口类
*/
public interface DataDictCatService extends BaseService {
/**
* 根据查询条件,查询并返回DataDictCat的列表
* @param q 查询条件
* @return
*/
public List<DataDictCat> getDataDictCatList(Query q);
/**
* 根据查询条件,分页查询并返回DataDictCat的分页结果
* @param q 查询条件
* @return
*/
public PageFinder<DataDictCat> getDataDictCatPagedList(Query q);
/**
* 根据主键,查询并返回一个DataDictCat对象
* @param id 主键id
* @return
*/
public DataDictCat getDataDictCat(String id);
/**
* 根据主键数组,查询并返回一组DataDictCat对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
public List<DataDictCat> getDataDictCatByIds(String[] ids);
/**
* 根据主键,删除特定的DataDictCat记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
public ResultInfo<DataDictCat> delDataDictCat(String id, Operator operator);
/**
* 新增一条DataDictCat记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param dataDictCat 新增的DataDictCat数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
public ResultInfo<DataDictCat> addDataDictCat(DataDictCat dataDictCat, Operator operator);
/**
* 根据主键,更新一条DataDictCat记录
* @param dataDictCat 更新的DataDictCat数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
public ResultInfo<DataDictCat> updateDataDictCat(DataDictCat dataDictCat, Operator operator);
/**
* 生成主键
* @return
*/
public String generatePK();
/**
* 为DataDictCat对象设置默认值
* @param obj
*/
public void fillDefaultValues(DataDictCat obj);
}
package cn.com.fqy.core.service;
import java.util.List;
import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseService;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.DataDictItem;
import cn.com.fqy.core.model.Query;
/**
* 数据字典的明细项表 服务接口类
*/
public interface DataDictItemService extends BaseService {
/**
* 根据查询条件,查询并返回DataDictItem的列表
* @param q 查询条件
* @return
*/
public List<DataDictItem> getDataDictItemList(Query q);
/**
* 根据查询条件,分页查询并返回DataDictItem的分页结果
* @param q 查询条件
* @return
*/
public PageFinder<DataDictItem> getDataDictItemPagedList(Query q);
/**
* 根据主键,查询并返回一个DataDictItem对象
* @param id 主键id
* @return
*/
public DataDictItem getDataDictItem(String id);
/**
* 根据字典分类编码,取得该分类下所有可用的数据字典项,以list形式返回
* @param catCode
* @return
*/
public List<DataDictItem> getDataDictItemListByCatCode(String catCode);
/**
* 根据主键数组,查询并返回一组DataDictItem对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
public List<DataDictItem> getDataDictItemByIds(String[] ids);
/**
* 根据主键,删除特定的DataDictItem记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
public ResultInfo<DataDictItem> delDataDictItem(String id, Operator operator);
/**
* 新增一条DataDictItem记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param dataDictItem 新增的DataDictItem数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
public ResultInfo<DataDictItem> addDataDictItem(DataDictItem dataDictItem, Operator operator);
/**
* 根据主键,更新一条DataDictItem记录
* @param dataDictItem 更新的DataDictItem数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
public ResultInfo<DataDictItem> updateDataDictItem(DataDictItem dataDictItem, Operator operator);
/**
* 生成主键
* @return
*/
public String generatePK();
/**
* 为DataDictItem对象设置默认值
* @param obj
*/
public void fillDefaultValues(DataDictItem obj);
public List<DataDictItem> getDataDictCatCode();
}
<?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.com.fqy.core.dao.DataDictCatDao">
<resultMap type="DataDictCat" id="DataDictCat">
<id column="DATA_DICT_CAT_CODE" property="dataDictCatCode" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="DATA_DICT_CAT_NAME" property="dataDictCatName" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="PARENT_CAT_CODE" property="parentCatCode" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="MEMO" property="memo" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="IS_AVAILABLE" property="isAvailable" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<result column="IS_DELETED" property="isDeleted" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<result column="CREATE_TIME" property="createTime" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result column="UPDATE_TIME" property="updateTime" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result column="OPERATOR_TYPE" property="operatorType" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<result column="OPERATOR_ID" property="operatorId" javaType="java.lang.String" jdbcType="VARCHAR"/>
</resultMap>
<!-- 全部字段,一般用于明细查询 -->
<sql id="AllColumnlist">
DATA_DICT_CAT_CODE,DATA_DICT_CAT_NAME,PARENT_CAT_CODE,MEMO,IS_AVAILABLE,IS_DELETED,CREATE_TIME,
UPDATE_TIME,OPERATOR_TYPE,OPERATOR_ID
</sql>
<!-- 常见字段,一般用于列表查询,可能不包含备注之类的字段 -->
<sql id="CommonColumnlist">
DATA_DICT_CAT_CODE,DATA_DICT_CAT_NAME,PARENT_CAT_CODE,MEMO,IS_AVAILABLE,IS_DELETED,CREATE_TIME,
UPDATE_TIME,OPERATOR_TYPE,OPERATOR_ID
</sql>
<insert id="add" parameterType="DataDictCat" useGeneratedKeys="true" keyProperty="dataDictCatCode">
insert into T_DATA_DICT_CAT(
<if test="dataDictCatCode!=null">
DATA_DICT_CAT_CODE,
</if>
DATA_DICT_CAT_NAME,
PARENT_CAT_CODE,
MEMO,
IS_AVAILABLE,
IS_DELETED,
CREATE_TIME,
UPDATE_TIME,
OPERATOR_TYPE,
OPERATOR_ID
) values (
<if test="dataDictCatCode!=null">
#{dataDictCatCode,jdbcType = VARCHAR},
</if>
#{dataDictCatName,jdbcType = VARCHAR},
#{parentCatCode,jdbcType = VARCHAR},
#{memo,jdbcType = VARCHAR},
#{isAvailable,jdbcType = TINYINT},
#{isDeleted,jdbcType = TINYINT},
#{createTime,jdbcType = TIMESTAMP},
#{updateTime,jdbcType = TIMESTAMP},
#{operatorType,jdbcType = TINYINT},
#{operatorId,jdbcType = VARCHAR}
)
</insert>
<update id="update" parameterType="DataDictCat">
update T_DATA_DICT_CAT
<set>
<if test="dataDictCatName!=null and dataDictCatName!=''">
DATA_DICT_CAT_NAME=#{dataDictCatName,jdbcType = VARCHAR},
</if>
<if test="parentCatCode!=null">
PARENT_CAT_CODE=#{parentCatCode,jdbcType = VARCHAR},
</if>
<if test="memo!=null and memo!=''">
MEMO=#{memo,jdbcType = VARCHAR},
</if>
<if test="isAvailable!=null ">
IS_AVAILABLE=#{isAvailable,jdbcType = TINYINT},
</if>
<if test="isDeleted!=null ">
IS_DELETED=#{isDeleted,jdbcType = TINYINT},
</if>
<if test="createTime!=null ">
CREATE_TIME=#{createTime,jdbcType = TIMESTAMP},
</if>
<if test="updateTime!=null ">
UPDATE_TIME=#{updateTime,jdbcType = TIMESTAMP},
</if>
<if test="operatorType!=null ">
OPERATOR_TYPE=#{operatorType,jdbcType = TINYINT},
</if>
<if test="operatorId!=null and operatorId!=''">
OPERATOR_ID=#{operatorId,jdbcType = VARCHAR},
</if>
</set>
<where>
AND DATA_DICT_CAT_CODE=#{dataDictCatCode}
</where>
</update>
<delete id="delete">
delete from T_DATA_DICT_CAT
<where>
DATA_DICT_CAT_CODE=#{0}
</where>
</delete>
<select id="get" resultMap="DataDictCat">
select <include refid="AllColumnlist"/> from T_DATA_DICT_CAT
<where>
DATA_DICT_CAT_CODE=#{0}
</where>
</select>
<select id="getByIds" resultMap="DataDictCat">
select <include refid="AllColumnlist"/> from T_DATA_DICT_CAT
<where>
DATA_DICT_CAT_CODE in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</select>
<select id="count" parameterType="Query" resultType="Long">
select count(DATA_DICT_CAT_CODE) from T_DATA_DICT_CAT
<where>
<include refid="listCommonWhere"/>
</where>
</select>
<select id="queryAll" parameterType="Query" resultMap="DataDictCat">
select <include refid="CommonColumnlist"/> from T_DATA_DICT_CAT
<where>
<include refid="listCommonWhere"/>
</where>
</select>
<select id="pageList" parameterType="Query" resultMap="DataDictCat">
select <include refid="CommonColumnlist"/> from T_DATA_DICT_CAT
<where>
<include refid="listCommonWhere"/>
</where>
<![CDATA[LIMIT #{rowIndex},#{pageSize} ]]>
</select>
<sql id="listCommonWhere">
<if test="q==null"><!-- 无传入参数时默认查未删除的 -->
AND IS_DELETED=0
</if>
<if test="q!=null">
<if test="q.dataDictCatCode!=null and q.dataDictCatCode!=''">
AND DATA_DICT_CAT_CODE like '%${q.dataDictCatCode}%'
</if>
<if test="q.dataDictCatName!=null and q.dataDictCatName!=''">
AND DATA_DICT_CAT_NAME like '%${q.dataDictCatName}%'
</if>
<if test="q.parentCatCode!=null and q.parentCatCode!=''">
AND PARENT_CAT_CODE=#{q.parentCatCode}
</if>
<if test="q.memo!=null and q.memo!=''">
AND MEMO=#{q.memo}
</if>
<if test="q.isAvailable!=null ">
AND IS_AVAILABLE=#{q.isAvailable}
</if>
<if test="q.isDeleted!=null ">
AND IS_DELETED=#{q.isDeleted}
</if>
<if test="q.createTime!=null ">
AND CREATE_TIME=#{q.createTime}
</if>
<if test="q.createTimeStart!=null">
<![CDATA[ AND CREATE_TIME>=#{q.createTimeStart} ]]>
</if>
<if test="q.createTimeEnd!=null">
<![CDATA[ AND CREATE_TIME<#{q.createTimeEnd} ]]>
</if>
<if test="q.updateTime!=null ">
AND UPDATE_TIME=#{q.updateTime}
</if>
<if test="q.updateTimeStart!=null">
<![CDATA[ AND UPDATE_TIME>=#{q.updateTimeStart} ]]>
</if>
<if test="q.updateTimeEnd!=null">
<![CDATA[ AND UPDATE_TIME<#{q.updateTimeEnd} ]]>
</if>
<if test="q.operatorType!=null ">
AND OPERATOR_TYPE=#{q.operatorType}
</if>
<if test="q.operatorId!=null and q.operatorId!=''">
AND OPERATOR_ID=#{q.operatorId}
</if>
</if>
</sql>
</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.com.fqy.core.dao.DataDictItemDao">
<resultMap type="DataDictItem" id="DataDictItem">
<id column="DATA_DICT_ITEM_ID" property="dataDictItemId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="DATA_DICT_CAT_CODE" property="dataDictCatCode" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="PARENT_ITEM_ID" property="parentItemId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="ITEM_VALUE" property="itemValue" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="MEMO" property="memo" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="IS_AVAILABLE" property="isAvailable" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<result column="AVAILABLE_UPDATE_TIME" property="availableUpdateTime" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result column="IS_DELETED" property="isDeleted" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<result column="CREATE_TIME" property="createTime" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result column="UPDATE_TIME" property="updateTime" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result column="OPERATOR_ID" property="operatorId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="OPERATOR_TYPE" property="operatorType" javaType="java.lang.Integer" jdbcType="TINYINT"/>
</resultMap>
<!-- 全部字段,一般用于明细查询 -->
<sql id="AllColumnlist">
DATA_DICT_ITEM_ID,DATA_DICT_CAT_CODE,PARENT_ITEM_ID,ITEM_VALUE,MEMO,IS_AVAILABLE,AVAILABLE_UPDATE_TIME,
IS_DELETED,CREATE_TIME,UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE
</sql>
<!-- 常见字段,一般用于列表查询,可能不包含备注之类的字段 -->
<sql id="CommonColumnlist">
DATA_DICT_ITEM_ID,DATA_DICT_CAT_CODE,PARENT_ITEM_ID,ITEM_VALUE,MEMO,IS_AVAILABLE,AVAILABLE_UPDATE_TIME,
IS_DELETED,CREATE_TIME,UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE
</sql>
<insert id="add" parameterType="DataDictItem" useGeneratedKeys="true" keyProperty="dataDictItemId">
insert into T_DATA_DICT_ITEM(
<if test="dataDictItemId!=null">
DATA_DICT_ITEM_ID,
</if>
DATA_DICT_CAT_CODE,
PARENT_ITEM_ID,
ITEM_VALUE,
MEMO,
IS_AVAILABLE,
AVAILABLE_UPDATE_TIME,
IS_DELETED,
CREATE_TIME,
UPDATE_TIME,
OPERATOR_ID,
OPERATOR_TYPE
) values (
<if test="dataDictItemId!=null">
#{dataDictItemId,jdbcType = VARCHAR},
</if>
#{dataDictCatCode,jdbcType = VARCHAR},
#{parentItemId,jdbcType = VARCHAR},
#{itemValue,jdbcType = VARCHAR},
#{memo,jdbcType = VARCHAR},
#{isAvailable,jdbcType = TINYINT},
#{availableUpdateTime,jdbcType = TIMESTAMP},
#{isDeleted,jdbcType = TINYINT},
#{createTime,jdbcType = TIMESTAMP},
#{updateTime,jdbcType = TIMESTAMP},
#{operatorId,jdbcType = VARCHAR},
#{operatorType,jdbcType = TINYINT}
)
</insert>
<update id="update" parameterType="DataDictItem">
update T_DATA_DICT_ITEM
<set>
<if test="dataDictCatCode!=null and dataDictCatCode!=''">
DATA_DICT_CAT_CODE=#{dataDictCatCode,jdbcType = VARCHAR},
</if>
<if test="parentItemId!=null and parentItemId!=''">
PARENT_ITEM_ID=#{parentItemId,jdbcType = VARCHAR},
</if>
<if test="itemValue!=null and itemValue!=''">
ITEM_VALUE=#{itemValue,jdbcType = VARCHAR},
</if>
<if test="memo!=null and memo!=''">
MEMO=#{memo,jdbcType = VARCHAR},
</if>
<if test="isAvailable!=null ">
IS_AVAILABLE=#{isAvailable,jdbcType = TINYINT},
</if>
<if test="availableUpdateTime!=null ">
AVAILABLE_UPDATE_TIME=#{availableUpdateTime,jdbcType = TIMESTAMP},
</if>
<if test="isDeleted!=null ">
IS_DELETED=#{isDeleted,jdbcType = TINYINT},
</if>
<if test="createTime!=null ">
CREATE_TIME=#{createTime,jdbcType = TIMESTAMP},
</if>
<if test="updateTime!=null ">
UPDATE_TIME=#{updateTime,jdbcType = TIMESTAMP},
</if>
<if test="operatorId!=null and operatorId!=''">
OPERATOR_ID=#{operatorId,jdbcType = VARCHAR},
</if>
<if test="operatorType!=null ">
OPERATOR_TYPE=#{operatorType,jdbcType = TINYINT},
</if>
</set>
<where>
AND DATA_DICT_ITEM_ID=#{dataDictItemId}
</where>
</update>
<delete id="delete">
delete from T_DATA_DICT_ITEM
<where>
DATA_DICT_ITEM_ID=#{0}
</where>
</delete>
<select id="get" resultMap="DataDictItem">
select <include refid="AllColumnlist"/> from T_DATA_DICT_ITEM
<where>
DATA_DICT_ITEM_ID=#{0}
</where>
</select>
<select id="getDataDictCatCode" resultMap="DataDictItem">
select DATA_DICT_ITEM_ID,DATA_DICT_CAT_CODE from T_DATA_DICT_ITEM group by DATA_DICT_CAT_CODE
</select>
<select id="getByIds" resultMap="DataDictItem">
select <include refid="AllColumnlist"/> from T_DATA_DICT_ITEM
<where>
DATA_DICT_ITEM_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</select>
<select id="count" parameterType="Query" resultType="Long">
select count(DATA_DICT_ITEM_ID) from T_DATA_DICT_ITEM
<where>
<include refid="listCommonWhere"/>
</where>
</select>
<select id="queryAll" parameterType="Query" resultMap="DataDictItem">
select <include refid="CommonColumnlist"/> from T_DATA_DICT_ITEM
<where>
<include refid="listCommonWhere"/>
</where>
</select>
<select id="pageList" parameterType="Query" resultMap="DataDictItem">
select <include refid="CommonColumnlist"/> from T_DATA_DICT_ITEM
<where>
<include refid="listCommonWhere"/>
</where>
<![CDATA[LIMIT #{rowIndex},#{pageSize} ]]>
</select>
<sql id="listCommonWhere">
<if test="q==null"><!-- 无传入参数时默认查未删除的 -->
AND IS_DELETED=0
</if>
<if test="q!=null">
<if test="q.dataDictItemId!=null and q.dataDictItemId!=''">
AND DATA_DICT_ITEM_ID=#{q.dataDictItemId}
</if>
<if test="q.dataDictCatCode!=null and q.dataDictCatCode!=''">
AND DATA_DICT_CAT_CODE like '%${q.dataDictCatCode}%'
</if>
<if test="q.parentItemId!=null and q.parentItemId!=''">
AND PARENT_ITEM_ID=#{q.parentItemId}
</if>
<if test="q.itemValue!=null and q.itemValue!=''">
AND ITEM_VALUE like '%${q.itemValue}%'
</if>
<if test="q.memo!=null and q.memo!=''">
AND MEMO=#{q.memo}
</if>
<if test="q.isAvailable!=null ">
AND IS_AVAILABLE=#{q.isAvailable}
</if>
<if test="q.availableUpdateTime!=null ">
AND AVAILABLE_UPDATE_TIME=#{q.availableUpdateTime}
</if>
<if test="q.availableUpdateTimeStart!=null">
<![CDATA[ AND AVAILABLE_UPDATE_TIME>=#{q.availableUpdateTimeStart} ]]>
</if>
<if test="q.availableUpdateTimeEnd!=null">
<![CDATA[ AND AVAILABLE_UPDATE_TIME<#{q.availableUpdateTimeEnd} ]]>
</if>
<if test="q.isDeleted!=null ">
AND IS_DELETED=#{q.isDeleted}
</if>
<if test="q.createTime!=null ">
AND CREATE_TIME=#{q.createTime}
</if>
<if test="q.createTimeStart!=null">
<![CDATA[ AND CREATE_TIME>=#{q.createTimeStart} ]]>
</if>
<if test="q.createTimeEnd!=null">
<![CDATA[ AND CREATE_TIME<#{q.createTimeEnd} ]]>
</if>
<if test="q.updateTime!=null ">
AND UPDATE_TIME=#{q.updateTime}
</if>
<if test="q.updateTimeStart!=null">
<![CDATA[ AND UPDATE_TIME>=#{q.updateTimeStart} ]]>
</if>
<if test="q.updateTimeEnd!=null">
<![CDATA[ AND UPDATE_TIME<#{q.updateTimeEnd} ]]>
</if>
<if test="q.operatorId!=null and q.operatorId!=''">
AND OPERATOR_ID=#{q.operatorId}
</if>
<if test="q.operatorType!=null ">
AND OPERATOR_TYPE=#{q.operatorType}
</if>
</if>
</sql>
</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