wuxw 3 lat temu
rodzic
commit
2cf0a9d123

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/Dict/DictDto.java

@@ -18,6 +18,8 @@ public class DictDto extends PageDto implements Serializable {
 
     private String tableName;
     private String tableColumns;
+    private String specName;
+    private String specId;
 
     public String getStatusCd() {
         return statusCd;
@@ -66,4 +68,20 @@ public class DictDto extends PageDto implements Serializable {
     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;
+    }
 }

+ 86 - 18
java110-db/src/main/resources/mapper/dev/DictV1ServiceDaoImplMapper.xml

@@ -49,42 +49,75 @@
 
     <!-- 修改字典表信息 add by wuxw 2018-07-03 -->
     <update id="updateDictInfo" parameterType="Map">
-        update t_dict t <set>
-        <if test="statusCd != null and statusCd != ''">
-            t.status_cd = #{statusCd},
+        update t_dict t
+        <set>
+            <if test="statusCd != null and statusCd != ''">
+                t.status_cd = #{statusCd},
+            </if>
+            <if test="tableColumns !=null and tableColumns != ''">
+                t.table_columns= #{tableColumns},
+            </if>
+            <if test="name !=null and name != ''">
+                t.name= #{name},
+            </if>
+            <if test="description !=null and description != ''">
+                t.description= #{description},
+            </if>
+            <if test="tableName !=null and tableName != ''">
+                t.table_name= #{tableName}
+            </if>
+        </set>
+        where 1=1
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
         </if>
+
+    </update>
+
+    <!-- 修改字典表信息 add by wuxw 2018-07-03 -->
+    <update id="deleteDictInfo" parameterType="Map">
+        delete from t_dict
+        where 1=1
+        and id= #{id}
+    </update>
+
+    <!-- 查询字典表数量 add by wuxw 2018-07-03 -->
+    <select id="queryDictsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from t_dict t
+        where 1 =1
         <if test="tableColumns !=null and tableColumns != ''">
-             t.table_columns= #{tableColumns},
+            and t.table_columns= #{tableColumns}
         </if>
         <if test="name !=null and name != ''">
-             t.name= #{name},
+            and t.name= #{name}
         </if>
         <if test="description !=null and description != ''">
-             t.description= #{description},
+            and t.description= #{description}
         </if>
-        <if test="tableName !=null and tableName != ''">
-             t.table_name= #{tableName}
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
         </if>
-    </set>
-        where 1=1
         <if test="id !=null and id != ''">
             and t.id= #{id}
         </if>
+        <if test="tableName !=null and tableName != ''">
+            and t.table_name= #{tableName}
+        </if>
 
-    </update>
 
-    <!-- 修改字典表信息 add by wuxw 2018-07-03 -->
-    <update id="deleteDictInfo" parameterType="Map">
-        delete from  t_dict
-        where 1=1
-            and id= #{id}
-    </update>
+    </select>
+
 
     <!-- 查询字典表数量 add by wuxw 2018-07-03 -->
-    <select id="queryDictsCount" parameterType="Map" resultType="Map">
+    <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>
@@ -107,4 +140,39 @@
 
     </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>

+ 19 - 0
java110-interface/src/main/java/com/java110/intf/dev/IDictV1InnerServiceSMO.java

@@ -65,4 +65,23 @@ public interface IDictV1InnerServiceSMO {
      */
     @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);
 }

+ 9 - 0
java110-utils/src/main/java/com/java110/utils/util/Java110Converter.java

@@ -87,14 +87,23 @@ public class Java110Converter implements Converter {
         }
 
         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));
         }
 

+ 16 - 2
service-dev/src/main/java/com/java110/dev/cmd/dict/SaveDictCmd.java

@@ -21,6 +21,8 @@ import com.java110.core.annotation.Java110Transactional;
 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;
@@ -31,6 +33,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 /**
  * 类表述:保存
  * 服务编码:dict.saveDict
@@ -51,12 +55,14 @@ public class SaveDictCmd extends Cmd {
     @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 @@ public class SaveDictCmd extends Cmd {
     @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) {

+ 17 - 0
service-dev/src/main/java/com/java110/dev/dao/IDictV1ServiceDao.java

@@ -80,4 +80,21 @@ public interface IDictV1ServiceDao {
      */
     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;
+
 }

+ 32 - 0
service-dev/src/main/java/com/java110/dev/dao/impl/DictV1ServiceDaoImpl.java

@@ -122,4 +122,36 @@ public class DictV1ServiceDaoImpl extends BaseServiceDao implements IDictV1Servi
     }
 
 
+    /**
+     * 查询字典表数量
+     * @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;
+    }
 }

+ 21 - 0
service-dev/src/main/java/com/java110/dev/smo/impl/DictV1InnerServiceSMOImpl.java

@@ -84,4 +84,25 @@ public class DictV1InnerServiceSMOImpl extends BaseServiceSMO implements IDictV1
     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));    }
+
 }