Commit b1fd4e2d by huangZW

111

parent b0185bf8
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class DictDTO implements Serializable {
private String dictId;
private String dictName;
private String dictKey;
private String dictTitle;
private String dictDesc;
private String dictContent;
private static final long serialVersionUID = 1L;
public String getDictId() {
return dictId;
}
public void setDictId(String dictId) {
this.dictId = dictId == null ? null : dictId.trim();
}
public String getDictName() {
return dictName;
}
public void setDictName(String dictName) {
this.dictName = dictName == null ? null : dictName.trim();
}
public String getDictKey() {
return dictKey;
}
public void setDictKey(String dictKey) {
this.dictKey = dictKey == null ? null : dictKey.trim();
}
public String getDictTitle() {
return dictTitle;
}
public void setDictTitle(String dictTitle) {
this.dictTitle = dictTitle == null ? null : dictTitle.trim();
}
public String getDictDesc() {
return dictDesc;
}
public void setDictDesc(String dictDesc) {
this.dictDesc = dictDesc == null ? null : dictDesc.trim();
}
public String getDictContent() {
return dictContent;
}
public void setDictContent(String dictContent) {
this.dictContent = dictContent == null ? null : dictContent.trim();
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.DictDTO;
/**
* Created by tgs on 2020/2/9.
*/
public interface DictApiService {
void saveDict(DictDTO dto);
DictDTO findOneDict(String dictId);
Page<DictDTO> pageList(BasePageInfo pageInfo);
}
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanDict;
import com.github.pagehelper.Page;
public interface DictMapper {
int deleteByPrimaryKey(String dictId);
......@@ -13,7 +14,8 @@ public interface DictMapper {
int updateByPrimaryKeySelective(TabHaobanDict record);
int updateByPrimaryKeyWithBLOBs(TabHaobanDict record);
int updateByPrimaryKey(TabHaobanDict record);
Page<TabHaobanDict> pageList();
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.DictDTO;
import com.gic.haoban.manage.api.service.DictApiService;
import com.gic.haoban.manage.service.dao.mapper.DictMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDict;
import com.github.pagehelper.PageHelper;
/**
* Created by tgs on 2020/2/9.
*/
public class DictServiceImpl implements DictApiService{
@Autowired
private DictMapper dictMapper;
@Override
public void saveDict(DictDTO dto) {
if(StringUtils.isBlank(dto.getDictId())){
//空,则新增
dto.setDictId(UuidUtil.randomUUID());
TabHaobanDict tab = EntityUtil.changeEntity(TabHaobanDict.class, dto);
dictMapper.insert(tab);
}else{
TabHaobanDict tab = EntityUtil.changeEntity(TabHaobanDict.class, dto);
dictMapper.updateByPrimaryKey(tab);
}
}
@Override
public DictDTO findOneDict(String dictId) {
TabHaobanDict tab = dictMapper.selectByPrimaryKey(dictId);
if(tab == null){
return null;
}
DictDTO dto = EntityUtil.changeEntity(DictDTO.class, tab);
return dto;
}
@Override
public Page<DictDTO> pageList(BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage( dictMapper.pageList(),DictDTO.class);
}
}
......@@ -34,6 +34,7 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.BindApiService" ref="bindApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" ref="applicationSettingApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.AuditSettingApiService" ref="auditSettingApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.DictApiService" ref="dictApiServiceImpl" timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
......
......@@ -7,21 +7,14 @@
<result column="dict_key" property="dictKey" jdbcType="VARCHAR" />
<result column="dict_title" property="dictTitle" jdbcType="VARCHAR" />
<result column="dict_desc" property="dictDesc" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.gic.haoban.manage.service.entity.TabHaobanDict" extends="BaseResultMap" >
<result column="dict_content" property="dictContent" jdbcType="LONGVARCHAR" />
<result column="dict_content" property="dictContent" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
dict_id, dict_name, dict_key, dict_title, dict_desc
</sql>
<sql id="Blob_Column_List" >
dict_content
dict_id, dict_name, dict_key, dict_title, dict_desc, dict_content
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from tab_haoban_dict
where dict_id = #{dictId,jdbcType=VARCHAR}
</select>
......@@ -34,7 +27,7 @@
dict_title, dict_desc, dict_content
)
values (#{dictId,jdbcType=VARCHAR}, #{dictName,jdbcType=VARCHAR}, #{dictKey,jdbcType=VARCHAR},
#{dictTitle,jdbcType=VARCHAR}, #{dictDesc,jdbcType=VARCHAR}, #{dictContent,jdbcType=LONGVARCHAR}
#{dictTitle,jdbcType=VARCHAR}, #{dictDesc,jdbcType=VARCHAR}, #{dictContent,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDict" >
......@@ -76,7 +69,7 @@
#{dictDesc,jdbcType=VARCHAR},
</if>
<if test="dictContent != null" >
#{dictContent,jdbcType=LONGVARCHAR},
#{dictContent,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -96,26 +89,24 @@
dict_desc = #{dictDesc,jdbcType=VARCHAR},
</if>
<if test="dictContent != null" >
dict_content = #{dictContent,jdbcType=LONGVARCHAR},
dict_content = #{dictContent,jdbcType=VARCHAR},
</if>
</set>
where dict_id = #{dictId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDict" >
update tab_haoban_dict
set dict_name = #{dictName,jdbcType=VARCHAR},
dict_key = #{dictKey,jdbcType=VARCHAR},
dict_title = #{dictTitle,jdbcType=VARCHAR},
dict_desc = #{dictDesc,jdbcType=VARCHAR},
dict_content = #{dictContent,jdbcType=LONGVARCHAR}
where dict_id = #{dictId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDict" >
update tab_haoban_dict
set dict_name = #{dictName,jdbcType=VARCHAR},
dict_key = #{dictKey,jdbcType=VARCHAR},
dict_title = #{dictTitle,jdbcType=VARCHAR},
dict_desc = #{dictDesc,jdbcType=VARCHAR}
dict_desc = #{dictDesc,jdbcType=VARCHAR},
dict_content = #{dictContent,jdbcType=VARCHAR}
where dict_id = #{dictId,jdbcType=VARCHAR}
</update>
<select id="pageList" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_dict
</select>
</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