java110-bean/src/main/java/com/java110/dto/Dict/DictDto.java
@@ -18,6 +18,8 @@ private String tableName; private String tableColumns; private String specName; private String specId; public String getStatusCd() { return statusCd; @@ -66,4 +68,20 @@ public void setId(int id) { this.id = id; } public String getSpecName() { return specName; } public void setSpecName(String specName) { this.specName = specName; } public String getSpecId() { return specId; } public void setSpecId(String specId) { this.specId = specId; } } java110-db/src/main/resources/mapper/dev/DictV1ServiceDaoImplMapper.xml
@@ -49,7 +49,8 @@ <!-- 修改字典表信息 add by wuxw 2018-07-03 --> <update id="updateDictInfo" parameterType="Map"> update t_dict t <set> update t_dict t <set> <if test="statusCd != null and statusCd != ''"> t.status_cd = #{statusCd}, </if> @@ -107,4 +108,71 @@ </select> <!-- 查询字典表数量 add by wuxw 2018-07-03 --> <select id="queryDictsAndSpecCount" parameterType="Map" resultType="Map"> select count(1) count from t_dict t inner JOIN t_dict_spec ds on t.table_name = ds.table_name and t.table_columns = ds.table_columns where 1 =1 <if test="specId !=null and specId != ''"> and ds.spec_id = #{specId} </if> <if test="tableColumns !=null and tableColumns != ''"> and t.table_columns= #{tableColumns} </if> <if test="name !=null and name != ''"> and t.name= #{name} </if> <if test="description !=null and description != ''"> and t.description= #{description} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="id !=null and id != ''"> and t.id= #{id} </if> <if test="tableName !=null and tableName != ''"> and t.table_name= #{tableName} </if> </select> <!-- 查询字典表信息 add by wuxw 2018-07-03 --> <select id="getDictAndSpecInfo" parameterType="Map" resultType="Map"> select t.table_columns,t.table_columns tableColumns,t.name,t.description,t.status_cd,t.status_cd statusCd,t.id,t.table_name,t.table_name tableName,ds.spec_name specName from t_dict t inner JOIN t_dict_spec ds on t.table_name = ds.table_name and t.table_columns = ds.table_columns where 1 =1 <if test="specId !=null and specId != ''"> and ds.spec_id = #{specId} </if> <if test="tableColumns !=null and tableColumns != ''"> and t.table_columns= #{tableColumns} </if> <if test="name !=null and name != ''"> and t.name= #{name} </if> <if test="description !=null and description != ''"> and t.description= #{description} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="id !=null and id != ''"> and t.id= #{id} </if> <if test="tableName !=null and tableName != ''"> and t.table_name= #{tableName} </if> order by t.create_time desc <if test="page != -1 and page != null "> limit #{page}, #{row} </if> </select> </mapper> java110-interface/src/main/java/com/java110/intf/dev/IDictV1InnerServiceSMO.java
@@ -65,4 +65,23 @@ */ @RequestMapping(value = "/queryDictsCount", method = RequestMethod.POST) int queryDictsCount(@RequestBody DictDto dictDto); /** * <p>查询小区楼信息</p> * * * @param dictDto 数据对象分享 * @return DictDto 对象数据 */ @RequestMapping(value = "/queryDictAndSpecs", method = RequestMethod.POST) List<DictDto> queryDictAndSpecs(@RequestBody DictDto dictDto); /** * 查询<p>小区楼</p>总记录数 * * @param dictDto 数据对象分享 * @return 小区下的小区楼记录数 */ @RequestMapping(value = "/queryDictsAndSpecCount", method = RequestMethod.POST) int queryDictsAndSpecCount(@RequestBody DictDto dictDto); } java110-utils/src/main/java/com/java110/utils/util/Java110Converter.java
@@ -87,14 +87,23 @@ } if (target == int.class || target == Integer.class) { if(StringUtil.isNullOrNone(value)){ return 0; } return Integer.parseInt(String.valueOf(value)); } if (target == long.class || target == Long.class) { if(StringUtil.isNullOrNone(value)){ return 0; } return Long.parseLong(String.valueOf(value)); } if (target == double.class || target == Double.class) { if(StringUtil.isNullOrNone(value)){ return 0; } return Double.parseDouble(String.valueOf(value)); } service-dev/src/main/java/com/java110/dev/cmd/dict/SaveDictCmd.java
@@ -21,6 +21,8 @@ import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.event.cmd.Cmd; import com.java110.core.event.cmd.CmdEvent; import com.java110.dto.dictSpec.DictSpecDto; import com.java110.intf.dev.IDictSpecV1InnerServiceSMO; import com.java110.intf.dev.IDictV1InnerServiceSMO; import com.java110.po.dict.DictPo; import com.java110.utils.exception.CmdException; @@ -30,6 +32,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; /** * 类表述:保存 @@ -51,12 +55,14 @@ @Autowired private IDictV1InnerServiceSMO dictV1InnerServiceSMOImpl; @Autowired private IDictSpecV1InnerServiceSMO dictSpecV1InnerServiceSMOImpl; @Override public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { Assert.hasKeyAndValue(reqJson, "statusCd", "请求报文中未包含statusCd"); Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name"); Assert.hasKeyAndValue(reqJson, "tableColumns", "请求报文中未包含tableColumns"); Assert.hasKeyAndValue(reqJson, "tableName", "请求报文中未包含tableName"); Assert.hasKeyAndValue(reqJson, "specId", "请求报文中未包含类型"); } @@ -64,7 +70,15 @@ @Java110Transactional public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { DictSpecDto dictSpecDto = new DictSpecDto(); dictSpecDto.setSpecId(reqJson.getString("specId")); List<DictSpecDto> dictSpecDtos = dictSpecV1InnerServiceSMOImpl.queryDictSpecs(dictSpecDto); Assert.listOnlyOne(dictSpecDtos,"未查询到类型"); DictPo dictPo = BeanConvertUtil.covertBean(reqJson, DictPo.class); dictPo.setTableName(dictSpecDtos.get(0).getTableName()); dictPo.setTableColumns(dictSpecDtos.get(0).getTableColumns()); int flag = dictV1InnerServiceSMOImpl.saveDict(dictPo); if (flag < 1) { service-dev/src/main/java/com/java110/dev/dao/IDictV1ServiceDao.java
@@ -80,4 +80,21 @@ */ int queryDictsCount(Map info); /** * 查询字典表总数 * * @param info 字典表信息 * @return 字典表数量 */ int queryDictsAndSpecCount(Map info); /** * 查询字典表信息(instance过程) * 根据bId 查询字典表信息 * @param info bId 信息 * @return 字典表信息 * @throws DAOException DAO异常 */ List<Map> getDictAndSpecInfo(Map info) throws DAOException; } service-dev/src/main/java/com/java110/dev/dao/impl/DictV1ServiceDaoImpl.java
@@ -122,4 +122,36 @@ } /** * 查询字典表数量 * @param info 字典表信息 * @return 字典表数量 */ @Override public int queryDictsAndSpecCount(Map info) { logger.debug("查询 queryDictsCount 入参 info : {}",info); List<Map> businessDictInfos = sqlSessionTemplate.selectList("dictV1ServiceDaoImpl.queryDictsAndSpecCount", info); if (businessDictInfos.size() < 1) { return 0; } return Integer.parseInt(businessDictInfos.get(0).get("count").toString()); } /** * 查询字典表信息(instance) * @param info bId 信息 * @return List<Map> * @throws DAOException DAO异常 */ @Override public List<Map> getDictAndSpecInfo(Map info) throws DAOException { logger.debug("查询 getDictInfo 入参 info : {}",info); List<Map> businessDictInfos = sqlSessionTemplate.selectList("dictV1ServiceDaoImpl.getDictAndSpecInfo",info); return businessDictInfos; } } service-dev/src/main/java/com/java110/dev/smo/impl/DictV1InnerServiceSMOImpl.java
@@ -84,4 +84,25 @@ public int queryDictsCount(@RequestBody DictDto dictDto) { return dictV1ServiceDaoImpl.queryDictsCount(BeanConvertUtil.beanCovertMap(dictDto)); } @Override public List<DictDto> queryDictAndSpecs(@RequestBody DictDto dictDto) { //校验是否传了 分页信息 int page = dictDto.getPage(); if (page != PageDto.DEFAULT_PAGE) { dictDto.setPage((page - 1) * dictDto.getRow()); } List<DictDto> dicts = BeanConvertUtil.covertBeanList(dictV1ServiceDaoImpl.getDictAndSpecInfo(BeanConvertUtil.beanCovertMap(dictDto)), DictDto.class); return dicts; } @Override public int queryDictsAndSpecCount(@RequestBody DictDto dictDto) { return dictV1ServiceDaoImpl.queryDictsAndSpecCount(BeanConvertUtil.beanCovertMap(dictDto)); } }