Commit 303f0d78 by 陶光胜

配置表

parent 58022c43
......@@ -17,7 +17,7 @@ public interface TableSettingApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> saveTableSetting(TableSettingDTO tableSettingDTO);
ServiceResponse<String> saveTableSetting(TableSettingDTO tableSettingDTO);
/**
* pageTableSetting
......
......@@ -63,4 +63,6 @@ public interface TabTableSettingMapper {
Page<TabTableSetting> pageTableSetting(@Param("search") String search);
TabTableSetting getTableSettingByTableName(@Param("tableName") String tableName);
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ import com.gic.enterprise.entity.TabTableSetting;
import com.github.pagehelper.Page;
public interface TableSettingService {
void saveTableSetting(TabTableSetting tabTableSetting);
String saveTableSetting(TabTableSetting tabTableSetting);
Page<TabTableSetting> pageTableSetting(String search);
......
......@@ -18,14 +18,20 @@ public class TableSettingServiceImpl implements TableSettingService {
private TabTableSettingMapper tabTableSettingMapper;
@Override
public void saveTableSetting(TabTableSetting tabTableSetting) {
public String saveTableSetting(TabTableSetting tabTableSetting) {
tabTableSetting.setUpdateTime(new Date());
if(tabTableSetting.getTableId() == null){
//校验是否重复
TabTableSetting existTable = tabTableSettingMapper.getTableSettingByTableName(tabTableSetting.getTableName());
if(existTable != null){
return "表名已经存在";
}
tabTableSetting.setCreateTime(new Date());
tabTableSettingMapper.insertSelective(tabTableSetting);
} else {
tabTableSettingMapper.updateByPrimaryKeySelective(tabTableSetting);
}
return null;
}
@Override
......
......@@ -7,10 +7,12 @@ import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.dto.TableSettingDTO;
import com.gic.enterprise.dto.TableSettingFieldDTO;
import com.gic.enterprise.entity.TabTableSetting;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.TableSettingApiService;
import com.gic.enterprise.service.TableSettingFieldService;
import com.gic.enterprise.service.TableSettingService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,9 +26,12 @@ public class TableSettingApiServiceImpl implements TableSettingApiService {
private TableSettingFieldService tableSettingFieldService;
@Override
public ServiceResponse<Void> saveTableSetting(TableSettingDTO tableSettingDTO) {
tableSettingService.saveTableSetting(EntityUtil.changeEntityByJSON(TabTableSetting.class, tableSettingDTO));
return ServiceResponse.success();
public ServiceResponse<String> saveTableSetting(TableSettingDTO tableSettingDTO) {
String result = tableSettingService.saveTableSetting(EntityUtil.changeEntityByJSON(TabTableSetting.class, tableSettingDTO));
if(StringUtils.isBlank(result)){
return ServiceResponse.success();
}
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), result);
}
@Override
......
......@@ -229,4 +229,11 @@
and (table_name like concat('%',search,'%') or remark like concat('%',search,'%'))
</if>
</select>
<select id="getTableSettingByTableName" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
from tab_table_setting
where delete_flag = 0
and table_name = #{tableName}
</select>
</mapper>
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.TableSettingDTO;
import com.gic.enterprise.dto.TableSettingFieldDTO;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.service.TableSettingApiService;
import com.gic.operation.web.qo.TableSettingFieldQO;
import com.gic.operation.web.qo.TableSettingQO;
......@@ -28,8 +29,11 @@ public class TableSettingController {
TableSettingDTO tableSettingDTO = EntityUtil.changeEntityByJSON(TableSettingDTO.class, param);
tableSettingDTO.setCreatetor(UserUtils.getUser().getId().toString());
tableSettingDTO.setCreatetorName(UserUtils.getUser().getUsername());
tableSettingApiService.saveTableSetting(tableSettingDTO);
return RestResponse.success();
ServiceResponse<String> response = tableSettingApiService.saveTableSetting(tableSettingDTO);
if(response.isSuccess()){
return RestResponse.success();
}
return EnterpriseRestResponse.failure(response);
}
@RequestMapping("page-table-setting")
......
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