feat:新增字典表(初)
parent
639cb8159e
commit
c5488049c1
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Dictionary extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String dictionaryName;
|
||||
|
||||
/**
|
||||
* 字典key
|
||||
*/
|
||||
private String dictionaryKey;
|
||||
|
||||
/**
|
||||
* 数据源ID
|
||||
*/
|
||||
private Long dataSourceId;
|
||||
|
||||
/**
|
||||
* 字典集合
|
||||
*/
|
||||
private List<DictionaryData> dictionaryDataList;
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DictionaryData extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典表Id
|
||||
*/
|
||||
private Long dictionaryId;
|
||||
|
||||
/**
|
||||
* 字典标签
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
private String val;
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
private Boolean isEdit = false;
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.muyu.etl.domain.DictionaryData;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictionaryDataMapper {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public DictionaryData selectDictionaryDataById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<DictionaryData> selectDictionaryDataList(DictionaryData dictionaryData);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictionaryData(DictionaryData dictionaryData);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictionaryData(DictionaryData dictionaryData);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryDataById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryDataByIds(Long[] ids);
|
||||
|
||||
List<DictionaryData> getDictionaryDataList(@Param("dictionaryIds") List<Long> dictionaryIds);
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.muyu.etl.domain.Dictionary;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictionaryMapper {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public Dictionary selectDictionaryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<Dictionary> selectDictionaryList(Dictionary dictionary);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictionary(Dictionary dictionary);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictionary(Dictionary dictionary);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryByIds(Long[] ids);
|
||||
|
||||
|
||||
List<Dictionary> getDictionaryList(@Param("dataSourceId") Long dataSourceId);
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.muyu.etl.domain.DictionaryData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictionaryDataService {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public DictionaryData selectDictionaryDataById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<DictionaryData> selectDictionaryDataList(DictionaryData dictionaryData);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictionaryData(DictionaryData dictionaryData);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictionaryData(DictionaryData dictionaryData);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryDataByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryDataById(Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.etl.domain.Dictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictionaryService {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public Dictionary selectDictionaryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<Dictionary> selectDictionaryList(Dictionary dictionary);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictionary(Dictionary dictionary);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictionary(Dictionary dictionary);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictionaryById(Long id);
|
||||
|
||||
|
||||
Result getDictionaryList(Long dataSourceId);
|
||||
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.etl.domain.DictionaryData;
|
||||
import com.muyu.etl.mapper.DictionaryDataMapper;
|
||||
import com.muyu.etl.mapper.DictionaryMapper;
|
||||
import com.muyu.etl.service.DictionaryDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DictionaryDataServiceImpl implements DictionaryDataService {
|
||||
|
||||
@Autowired
|
||||
private DictionaryDataMapper dictionaryDataMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public DictionaryData selectDictionaryDataById(Long id)
|
||||
{
|
||||
return dictionaryDataMapper.selectDictionaryDataById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<DictionaryData> selectDictionaryDataList(DictionaryData dictionaryData)
|
||||
{
|
||||
return dictionaryDataMapper.selectDictionaryDataList(dictionaryData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDictionaryData(DictionaryData dictionaryData)
|
||||
{
|
||||
dictionaryData.setCreateTime(DateUtils.getNowDate());
|
||||
dictionaryData.setCreateBy(SecurityUtils.getUsername());
|
||||
return dictionaryDataMapper.insertDictionaryData(dictionaryData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dictionaryData 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictionaryData(DictionaryData dictionaryData)
|
||||
{
|
||||
dictionaryData.setUpdateTime(DateUtils.getNowDate());
|
||||
dictionaryData.setUpdateBy(SecurityUtils.getUsername());
|
||||
return dictionaryDataMapper.updateDictionaryData(dictionaryData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictionaryDataByIds(Long[] ids)
|
||||
{
|
||||
return dictionaryDataMapper.deleteDictionaryDataByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictionaryDataById(Long id)
|
||||
{
|
||||
return dictionaryDataMapper.deleteDictionaryDataById(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.etl.domain.DictionaryData;
|
||||
import com.muyu.etl.mapper.DictionaryDataMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.DictionaryMapper;
|
||||
import com.muyu.etl.domain.Dictionary;
|
||||
import com.muyu.etl.service.DictionaryService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-25
|
||||
*/
|
||||
@Service
|
||||
public class DictionaryServiceImpl implements DictionaryService {
|
||||
|
||||
@Autowired
|
||||
private DictionaryMapper dictionaryMapper;
|
||||
|
||||
@Autowired
|
||||
private DictionaryDataMapper dictionaryDataMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public Dictionary selectDictionaryById(Long id) {
|
||||
return dictionaryMapper.selectDictionaryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<Dictionary> selectDictionaryList(Dictionary dictionary) {
|
||||
return dictionaryMapper.selectDictionaryList(dictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDictionary(Dictionary dictionary) {
|
||||
dictionary.setCreateTime(DateUtils.getNowDate());
|
||||
dictionary.setCreateBy(SecurityUtils.getUsername());
|
||||
return dictionaryMapper.insertDictionary(dictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dictionary 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictionary(Dictionary dictionary) {
|
||||
dictionary.setUpdateTime(DateUtils.getNowDate());
|
||||
dictionary.setUpdateBy(SecurityUtils.getUsername());
|
||||
return dictionaryMapper.updateDictionary(dictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictionaryByIds(Long[] ids) {
|
||||
return dictionaryMapper.deleteDictionaryByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictionaryById(Long id) {
|
||||
return dictionaryMapper.deleteDictionaryById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getDictionaryList(Long dataSourceId) {
|
||||
List<Dictionary> dictionaryList = dictionaryMapper.getDictionaryList(dataSourceId);
|
||||
if (!dictionaryList.isEmpty()){
|
||||
List<Long> longs = dictionaryList.stream()
|
||||
.map(Dictionary::getId).toList();
|
||||
List<DictionaryData> dictionaryDataList = dictionaryDataMapper.getDictionaryDataList(longs);
|
||||
dictionaryList.stream()
|
||||
.forEach(dictionary->{
|
||||
dictionaryDataList.stream().filter(dictionaryData -> dictionaryData.getDictionaryId().equals(dictionary.getId()) ).toList();
|
||||
dictionary.setDictionaryDataList(dictionaryDataList);
|
||||
});
|
||||
}
|
||||
return Result.success(dictionaryList);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
<?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.muyu.etl.mapper.DictionaryDataMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.DictionaryData" id="DictionaryDataResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dictionaryId" column="dictionary_id" />
|
||||
<result property="label" column="label" />
|
||||
<result property="val" column="val" />
|
||||
<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="selectDictionaryDataVo">
|
||||
select id, dictionary_id, label, val, create_by, create_time, update_by, update_time, remark from dictionarydata
|
||||
</sql>
|
||||
|
||||
<select id="selectDictionaryDataList" parameterType="com.muyu.etl.domain.DictionaryData" resultMap="DictionaryDataResult">
|
||||
<include refid="selectDictionaryDataVo"/>
|
||||
<where>
|
||||
<if test="dictionaryId != null "> and dictionary_id = #{dictionaryId}</if>
|
||||
<if test="label != null and dictionaryTag != ''"> and label = #{label}</if>
|
||||
<if test="val != null and dictionaryValue != ''"> and val = #{val}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDictionaryDataById" parameterType="Long" resultMap="DictionaryDataResult">
|
||||
<include refid="selectDictionaryDataVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getDictionaryDataList" resultType="com.muyu.etl.domain.DictionaryData">
|
||||
<include refid="selectDictionaryDataVo"></include>
|
||||
<where>
|
||||
and dictionary_id in (
|
||||
<foreach item="id" index="index" collection="dictionaryIds" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertDictionaryData" parameterType="com.muyu.etl.domain.DictionaryData" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into dictionarydata
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dictionaryId != null">dictionary_id,</if>
|
||||
<if test="label != null">label,</if>
|
||||
<if test="val != null">val,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dictionaryId != null">#{dictionaryId},</if>
|
||||
<if test="label != null">#{label},</if>
|
||||
<if test="val != null">#{val},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDictionaryData" parameterType="com.muyu.etl.domain.DictionaryData">
|
||||
update dictionarydata
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dictionaryId != null">dictionary_id = #{dictionaryId},</if>
|
||||
<if test="label != null">label = #{label},</if>
|
||||
<if test="val != null">val = #{val},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDictionaryDataById" parameterType="Long">
|
||||
delete from dictionarydata where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDictionaryDataByIds" parameterType="String">
|
||||
delete from dictionarydata where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,92 @@
|
|||
<?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.muyu.etl.mapper.DictionaryMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.Dictionary" id="DictionaryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dictionaryName" column="dictionary_name" />
|
||||
<result property="dictionaryKey" column="dictionary_key" />
|
||||
<result property="dataSourceId" column="data_source_id" />
|
||||
<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="selectDictionaryVo">
|
||||
select id, dictionary_name, dictionary_key,data_source_id, create_by, create_time, update_by, update_time, remark from dictionary
|
||||
</sql>
|
||||
|
||||
<select id="selectDictionaryList" parameterType="com.muyu.etl.domain.Dictionary" resultMap="DictionaryResult">
|
||||
<include refid="selectDictionaryVo"/>
|
||||
<where>
|
||||
<if test="dictionaryName != null and dictionaryName != ''"> and dictionary_name like concat('%', #{dictionaryName}, '%')</if>
|
||||
<if test="dictionaryKey != null and dictionaryKey != ''"> and dictionary_key = #{dictionaryKey}</if>
|
||||
<if test="dataSourceId != null"> and data_source_id = #{dataSourceId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDictionaryById" parameterType="Long" resultMap="DictionaryResult">
|
||||
<include refid="selectDictionaryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getDictionaryList" resultType="com.muyu.etl.domain.Dictionary">
|
||||
<include refid="selectDictionaryVo"></include>
|
||||
<where>
|
||||
and data_source_id = #{dataSourceId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertDictionary" parameterType="com.muyu.etl.domain.Dictionary" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into dictionary
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dictionaryName != null">dictionary_name,</if>
|
||||
<if test="dictionaryKey != null">dictionary_key,</if>
|
||||
<if test="dataSourceId != null">data_source_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dictionaryName != null">#{dictionaryName},</if>
|
||||
<if test="dictionaryKey != null">#{dictionaryKey},</if>
|
||||
<if test="dataSourceId != null">#{dataSourceId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDictionary" parameterType="com.muyu.etl.domain.Dictionary">
|
||||
update dictionary
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dictionaryName != null">dictionary_name = #{dictionaryName},</if>
|
||||
<if test="dictionaryKey != null">dictionary_key = #{dictionaryKey},</if>
|
||||
<if test="dataSourceId != null">data_source_id = #{dataSourceId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDictionaryById" parameterType="Long">
|
||||
delete from dictionary where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDictionaryByIds" parameterType="String">
|
||||
delete from dictionary where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue