reg_dict
This commit is contained in:
parent
d5e51048a3
commit
aaf524ee70
@ -296,3 +296,27 @@ ALTER TABLE [dbo].[reg_itemclass] ADD DEFAULT (1) FOR [itemclass_printcnt]
|
|||||||
ALTER TABLE [dbo].[reg_itemclass] ADD DEFAULT ('') FOR [update_by]
|
ALTER TABLE [dbo].[reg_itemclass] ADD DEFAULT ('') FOR [update_by]
|
||||||
ALTER TABLE [dbo].[reg_itemclass] ADD DEFAULT (NULL) FOR [remark]
|
ALTER TABLE [dbo].[reg_itemclass] ADD DEFAULT (NULL) FOR [remark]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'req_dict')
|
||||||
|
begin
|
||||||
|
CREATE TABLE [dbo].[reg_dict](
|
||||||
|
[dict_id] [bigint] IDENTITY(1,1) NOT NULL,
|
||||||
|
[dict_type] [varchar](20) NOT NULL,
|
||||||
|
[dict_code] [varchar](64) NOT NULL,
|
||||||
|
[dict_name] [varchar](250) NOT NULL,
|
||||||
|
[dict_sort] [int] NOT NULL,
|
||||||
|
[status] [char](1) NOT NULL,
|
||||||
|
[create_by] [varchar](64) NULL,
|
||||||
|
[create_time] [datetime] NULL,
|
||||||
|
[update_by] [varchar](64) NULL,
|
||||||
|
[update_time] [datetime] NULL,
|
||||||
|
[remark] [varchar](500) NULL,
|
||||||
|
PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[dict_id] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY]
|
||||||
|
ALTER TABLE [dbo].[reg_dict] ADD DEFAULT ('') FOR [create_by]
|
||||||
|
ALTER TABLE [dbo].[reg_dict] ADD DEFAULT ('') FOR [update_by]
|
||||||
|
ALTER TABLE [dbo].[reg_dict] ADD DEFAULT (NULL) FOR [remark]
|
||||||
|
end
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
package com.czlis.transitPF.controller.dict;
|
||||||
|
|
||||||
|
import com.czlis.common.annotation.Log;
|
||||||
|
import com.czlis.common.core.controller.BaseController;
|
||||||
|
import com.czlis.common.core.domain.AjaxResult;
|
||||||
|
import com.czlis.common.core.page.TableDataInfo;
|
||||||
|
import com.czlis.common.enums.BusinessType;
|
||||||
|
import com.czlis.common.utils.poi.ExcelUtil;
|
||||||
|
import com.czlis.transitPF.pojo.RegDict;
|
||||||
|
import com.czlis.transitPF.service.RegDictService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Api(tags = "区域检验中心-常用字典管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/transitdict/regdict")
|
||||||
|
@Slf4j
|
||||||
|
public class RegDictController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private RegDictService regDictService;
|
||||||
|
/**
|
||||||
|
* 获取字典列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取字典列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(RegDict post) {
|
||||||
|
startPage();
|
||||||
|
List<RegDict> list = regDictService.selectDictList(post);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
@ApiOperation("字典导出")
|
||||||
|
@Log(title = "字典导出", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, RegDict post) {
|
||||||
|
List<RegDict> list = regDictService.selectDictList(post);
|
||||||
|
ExcelUtil<RegDict> util = new ExcelUtil<>(RegDict.class);
|
||||||
|
util.exportExcel(response, list, "字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典编号获取详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取详细信息")
|
||||||
|
@GetMapping(value = "/{dictId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictId) {
|
||||||
|
return success(regDictService.selectDictById(dictId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增字典")
|
||||||
|
@Log(title = "字典管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody RegDict post) {
|
||||||
|
if (!regDictService.checkDictNameUnique(post)) {
|
||||||
|
return error("新增字典'" + post.getDictName() + "'失败,字典名称已存在");
|
||||||
|
} else if (!regDictService.checkDictCodeUnique(post)) {
|
||||||
|
return error("新增字典'" + post.getDictName() + "'失败,字典编码已存在");
|
||||||
|
}
|
||||||
|
post.setCreateBy(getUsername());
|
||||||
|
return toAjax(regDictService.insertDict(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改字典")
|
||||||
|
@Log(title = "字典管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody RegDict post) {
|
||||||
|
if (!regDictService.checkDictNameUnique(post)) {
|
||||||
|
return error("修改字典'" + post.getDictName() + "'失败,字典名称已存在");
|
||||||
|
} else if (!regDictService.checkDictCodeUnique(post)) {
|
||||||
|
return error("修改字典'" + post.getDictName() + "'失败,字典编码已存在");
|
||||||
|
}
|
||||||
|
post.setUpdateBy(getUsername());
|
||||||
|
return toAjax(regDictService.updateDict(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除字典")
|
||||||
|
@Log(title = "字典管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictIds) {
|
||||||
|
return toAjax(regDictService.deleteDictByIds(dictIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典选择框列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取字典选择框列表")
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect() {
|
||||||
|
List<RegDict> posts = regDictService.selectDictAll();
|
||||||
|
return success(posts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package com.czlis.transitPF.mapper;
|
||||||
|
|
||||||
|
import com.czlis.transitPF.pojo.RegDict;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RegDictMapper {
|
||||||
|
/**
|
||||||
|
* 查询字典数据集合
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 字典数据集合
|
||||||
|
*/
|
||||||
|
List<RegDict> selectDictList(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有字典
|
||||||
|
*
|
||||||
|
* @return 字典列表
|
||||||
|
*/
|
||||||
|
List<RegDict> selectDictAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID查询字典信息
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 角色对象信息
|
||||||
|
*/
|
||||||
|
RegDict selectDictById(Long DictId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典信息
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteDictById(Long DictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典信息
|
||||||
|
*
|
||||||
|
* @param DictIds 需要删除的字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteDictByIds(Long[] DictIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典信息
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateDict(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典信息
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertDict(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典名称
|
||||||
|
*
|
||||||
|
* @param dictName 字典名称
|
||||||
|
* @param dictType 类别
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
RegDict checkDictNameUnique(@Param("dictName") String dictName,@Param("dictType") String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典编码
|
||||||
|
*
|
||||||
|
* @param DictCode 字典编码
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
RegDict checkDictCodeUnique(@Param("dictCode") String DictCode,@Param("dictType") String dictType);
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.czlis.transitPF.pojo;
|
||||||
|
|
||||||
|
import com.czlis.common.annotation.Excel;
|
||||||
|
import com.czlis.common.core.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class RegDict extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 字典序号
|
||||||
|
*/
|
||||||
|
@Excel(name = "字典序号", cellType = Excel.ColumnType.NUMERIC)
|
||||||
|
private Long dictId;
|
||||||
|
/**
|
||||||
|
* 字典编码
|
||||||
|
*/
|
||||||
|
@Excel(name = "字典类别")
|
||||||
|
private String dictType;
|
||||||
|
/**
|
||||||
|
* 字典编码
|
||||||
|
*/
|
||||||
|
@Excel(name = "字典编码")
|
||||||
|
private String dictCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "字典名称")
|
||||||
|
private String dictName;
|
||||||
|
/**
|
||||||
|
* 字典排序
|
||||||
|
*/
|
||||||
|
@Excel(name = "排序")
|
||||||
|
private Long dictSort;
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
package com.czlis.transitPF.service;
|
||||||
|
|
||||||
|
import com.czlis.transitPF.pojo.RegDict;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RegDictService {
|
||||||
|
/**
|
||||||
|
* 查询字典信息集合
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 字典列表
|
||||||
|
*/
|
||||||
|
List<RegDict> selectDictList(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有字典
|
||||||
|
*
|
||||||
|
* @return 字典列表
|
||||||
|
*/
|
||||||
|
List<RegDict> selectDictAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID查询字典信息
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 角色对象信息
|
||||||
|
*/
|
||||||
|
RegDict selectDictById(Long DictId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典名称
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean checkDictNameUnique(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典编码
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean checkDictCodeUnique(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID查询字典使用数量
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int countUserDictById(Long DictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典信息
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteDictById(Long DictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典信息
|
||||||
|
*
|
||||||
|
* @param DictIds 需要删除的字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteDictByIds(Long[] DictIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典信息
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertDict(RegDict Dict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典信息
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateDict(RegDict Dict);
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package com.czlis.transitPF.service.impl;
|
||||||
|
|
||||||
|
import com.czlis.common.constant.UserConstants;
|
||||||
|
import com.czlis.common.exception.ServiceException;
|
||||||
|
import com.czlis.common.utils.StringUtils;
|
||||||
|
import com.czlis.transitPF.mapper.RegDictMapper;
|
||||||
|
import com.czlis.transitPF.pojo.RegDict;
|
||||||
|
import com.czlis.transitPF.service.RegDictService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class RegDictServiceImpl implements RegDictService {
|
||||||
|
@Autowired
|
||||||
|
RegDictMapper dictMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典信息集合
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 字典信息集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RegDict> selectDictList(RegDict Dict) {
|
||||||
|
return dictMapper.selectDictList(Dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有字典
|
||||||
|
*
|
||||||
|
* @return 字典列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RegDict> selectDictAll() {
|
||||||
|
return dictMapper.selectDictAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID查询字典信息
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 角色对象信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RegDict selectDictById(Long DictId) {
|
||||||
|
return dictMapper.selectDictById(DictId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典名称是否唯一
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkDictNameUnique(RegDict Dict) {
|
||||||
|
Long DictId = StringUtils.isNull(Dict.getDictId()) ? -1L : Dict.getDictId();
|
||||||
|
RegDict info = dictMapper.checkDictNameUnique(Dict.getDictName(),Dict.getDictType());
|
||||||
|
if (StringUtils.isNotNull(info) && info.getDictId().longValue() != DictId.longValue()) {
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典编码是否唯一
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkDictCodeUnique(RegDict Dict) {
|
||||||
|
Long DictId = StringUtils.isNull(Dict.getDictId()) ? -1L : Dict.getDictId();
|
||||||
|
RegDict info = dictMapper.checkDictCodeUnique(Dict.getDictCode(),Dict.getDictType());
|
||||||
|
if (StringUtils.isNotNull(info) && info.getDictId().longValue() != DictId.longValue()) {
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID查询字典使用数量
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int countUserDictById(Long DictId) {
|
||||||
|
return 0;//dictMapper.countUserDictById(DictId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典信息
|
||||||
|
*
|
||||||
|
* @param DictId 字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDictById(Long DictId) {
|
||||||
|
return dictMapper.deleteDictById(DictId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典信息
|
||||||
|
*
|
||||||
|
* @param DictIds 需要删除的字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDictByIds(Long[] DictIds) {
|
||||||
|
for (Long DictId : DictIds) {
|
||||||
|
RegDict Dict = selectDictById(DictId);
|
||||||
|
if (countUserDictById(DictId) > 0) {
|
||||||
|
throw new ServiceException(String.format("%1$s已分配,不能删除", Dict.getDictName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dictMapper.deleteDictByIds(DictIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典信息
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDict(RegDict Dict) {
|
||||||
|
return dictMapper.insertDict(Dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典信息
|
||||||
|
*
|
||||||
|
* @param Dict 字典信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDict(RegDict Dict) {
|
||||||
|
return dictMapper.updateDict(Dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
122
transitPF/src/main/resources/mapper/RegDictMapper.xml
Normal file
122
transitPF/src/main/resources/mapper/RegDictMapper.xml
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?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.czlis.transitPF.mapper.RegDictMapper">
|
||||||
|
<resultMap type="RegDict" id="RegDictResult">
|
||||||
|
<id property="dictId" column="dict_id" />
|
||||||
|
<result property="dictType" column="dict_type" />
|
||||||
|
<result property="dictCode" column="dict_code" />
|
||||||
|
<result property="dictName" column="dict_name" />
|
||||||
|
<result property="dictSort" column="dict_Sort" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDictVo">
|
||||||
|
select dict_id,dict_type, dict_code, dict_name, dict_Sort, status, create_by, create_time, remark
|
||||||
|
from Reg_Dict
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDictList" parameterType="RegDict" resultMap="RegDictResult">
|
||||||
|
<include refid="selectDictVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dictCode != null and dictCode != ''">
|
||||||
|
AND dict_code like '%'+#{dictCode}+'%'
|
||||||
|
</if>
|
||||||
|
<if test="dictType != null and dictType != ''">
|
||||||
|
AND dict_type = #{dictType}
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="dictName != null and dictName != ''">
|
||||||
|
AND dict_name like '%'+#{dictName}+'%'
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by dict_Sort
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictAll" resultMap="RegDictResult">
|
||||||
|
<include refid="selectDictVo"/>
|
||||||
|
order by dict_Sort
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictById" parameterType="Long" resultMap="RegDictResult">
|
||||||
|
<include refid="selectDictVo"/>
|
||||||
|
where dict_id = #{dictId}
|
||||||
|
</select>
|
||||||
|
<select id="selectDictByType" parameterType="Long" resultMap="RegDictResult">
|
||||||
|
<include refid="selectDictVo"/>
|
||||||
|
where dict_type = #{dictType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="checkDictNameUnique" parameterType="String" resultMap="RegDictResult">
|
||||||
|
select top 1 dict_id, dict_code, dict_name, dict_Sort, status, create_by, create_time, remark
|
||||||
|
from Reg_Dict
|
||||||
|
where dict_name=#{dictName} and dict_type = #{dictType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkDictCodeUnique" parameterType="String" resultMap="RegDictResult">
|
||||||
|
select top 1 dict_id, dict_code, dict_name, dict_Sort, status, create_by, create_time, remark
|
||||||
|
from Reg_Dict
|
||||||
|
where dict_code=#{dictCode} and dict_type = #{dictType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateDict" parameterType="RegDict">
|
||||||
|
update Reg_Dict
|
||||||
|
<set>
|
||||||
|
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
|
||||||
|
<if test="dictCode != null and dictCode != ''">dict_code = #{dictCode},</if>
|
||||||
|
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
|
||||||
|
<if test="dictSort != null">dict_Sort = #{dictSort},</if>
|
||||||
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = getdate()
|
||||||
|
</set>
|
||||||
|
where dict_id = #{dictId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertDict" parameterType="RegDict" useGeneratedKeys="true" keyProperty="dictId">
|
||||||
|
insert into Reg_Dict(
|
||||||
|
<if test="dictId != null and dictId != 0">dict_id,</if>
|
||||||
|
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||||
|
<if test="dictCode != null and dictCode != ''">dict_code,</if>
|
||||||
|
<if test="dictName != null and dictName != ''">dict_name,</if>
|
||||||
|
<if test="dictSort != null">dict_Sort,</if>
|
||||||
|
<if test="status != null and status != ''">status,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="dictId != null and dictId != 0">#{dictId},</if>
|
||||||
|
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||||
|
<if test="dictCode != null and dictCode != ''">#{dictCode},</if>
|
||||||
|
<if test="dictName != null and dictName != ''">#{dictName},</if>
|
||||||
|
<if test="dictSort != null">#{dictSort},</if>
|
||||||
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
getdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="deleteDictById" parameterType="Long">
|
||||||
|
delete from Reg_Dict where dict_id = #{dictId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDictByIds" parameterType="Long">
|
||||||
|
delete from Reg_Dict where dict_id in
|
||||||
|
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
||||||
|
#{dictId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user