Compare commits
	
		
			No commits in common. "f96474e739618eac8b2b51f1fde46598bf51a5dd" and "35a62045d5295a21d198a1bf790938b3204b0724" have entirely different histories.
		
	
	
		
			f96474e739
			...
			35a62045d5
		
	
		|  | @ -4,7 +4,6 @@ import com.ebts.common.core.controller.BaseController; | |||
| import com.ebts.common.core.entity.Result; | ||||
| import com.ebts.common.utils.MapExcelUtil; | ||||
| import com.ebts.common.utils.StringUtils; | ||||
| import com.ebts.generator.entity.UniColumnInfo; | ||||
| import com.ebts.generator.utils.sql.GenSqlUtil; | ||||
| import com.github.pagehelper.PageHelper; | ||||
| import com.ebts.generator.entity.UniCon; | ||||
|  | @ -47,12 +46,9 @@ public class QueryController extends BaseController { | |||
|             UniQuery uniQuery = result.getData(); | ||||
|             Map<String, Object> modeMap = new HashMap<>(); | ||||
|             List<UniCon> uniCons = uniQuery.getUniCons(); | ||||
|             List<UniColumnInfo> infoList = uniQuery.getInfoList(); | ||||
|             uniQuery.setInfoList(null); | ||||
|             uniQuery.setUniCons(null); | ||||
|             modeMap.put("info", uniQuery); | ||||
|             modeMap.put("list", uniCons); | ||||
|             modeMap.put("infoList", infoList); | ||||
|             return Result.ok(modeMap); | ||||
|         } else { | ||||
|             return Result.error(result.getMsg()); | ||||
|  | @ -68,9 +64,6 @@ public class QueryController extends BaseController { | |||
|     @PreAuthorize("@ebts.hasPermi('query:edit')") | ||||
|     @PutMapping | ||||
|     public Result<Integer> edit(@Validated @RequestBody UniQuery uniQuery) { | ||||
|         if (uniQuery.getInfoList().size() == 0){ | ||||
|             return Result.error("字段信息为空,请提取字段信息!"); | ||||
|         } | ||||
|         return queryService.updateQueryInfo(uniQuery); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,17 +0,0 @@ | |||
| package com.ebts.generator.dao; | ||||
| 
 | ||||
| import com.ebts.generator.entity.UniColumnInfo; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| public interface UniColumnInfoDao { | ||||
| 
 | ||||
| 
 | ||||
|     int insertUniColumnInfo(@Param("list") List<UniColumnInfo> infoList); | ||||
| 
 | ||||
|     int deleteUniColumnInfo(@Param("queryId") long queryId); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -1,36 +0,0 @@ | |||
| package com.ebts.generator.entity; | ||||
| 
 | ||||
| import lombok.Builder; | ||||
| import lombok.Data; | ||||
| 
 | ||||
| //@Data | ||||
| //@Builder | ||||
| public class UniColumnInfo { | ||||
|     private long queryId; | ||||
|     private String prop; | ||||
|     private String label; | ||||
| 
 | ||||
|     public long getQueryId() { | ||||
|         return queryId; | ||||
|     } | ||||
| 
 | ||||
|     public void setQueryId(long queryId) { | ||||
|         this.queryId = queryId; | ||||
|     } | ||||
| 
 | ||||
|     public String getProp() { | ||||
|         return prop; | ||||
|     } | ||||
| 
 | ||||
|     public void setProp(String prop) { | ||||
|         this.prop = prop; | ||||
|     } | ||||
| 
 | ||||
|     public String getLabel() { | ||||
|         return label; | ||||
|     } | ||||
| 
 | ||||
|     public void setLabel(String label) { | ||||
|         this.label = label; | ||||
|     } | ||||
| } | ||||
|  | @ -56,19 +56,6 @@ public class UniQuery extends BaseEntity { | |||
| 
 | ||||
|     private Integer pageSize; | ||||
| 
 | ||||
|     private List<UniColumnInfo> infoList; | ||||
| 
 | ||||
|     public List<UniColumnInfo> getInfoList() { | ||||
|         if (infoList == null){ | ||||
|             infoList = new ArrayList<>(); | ||||
|         } | ||||
|         return infoList; | ||||
|     } | ||||
| 
 | ||||
|     public void setInfoList(List<UniColumnInfo> infoList) { | ||||
|         this.infoList = infoList; | ||||
|     } | ||||
| 
 | ||||
|     public String getTopJson() { | ||||
|         return topJson; | ||||
|     } | ||||
|  |  | |||
|  | @ -6,9 +6,7 @@ import com.ebts.common.core.entity.Result; | |||
| import com.ebts.common.core.entity.entity.Menu; | ||||
| import com.ebts.common.utils.SecurityUtils; | ||||
| import com.ebts.generator.dao.QueryDao; | ||||
| import com.ebts.generator.dao.UniColumnInfoDao; | ||||
| import com.ebts.generator.dao.UniQueryDao; | ||||
| import com.ebts.generator.entity.UniColumnInfo; | ||||
| import com.ebts.generator.entity.UniCon; | ||||
| import com.ebts.generator.entity.UniQuery; | ||||
| import com.ebts.generator.service.QueryService; | ||||
|  | @ -23,7 +21,6 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport; | |||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| /** | ||||
|  * Author 18209 | ||||
|  | @ -40,9 +37,6 @@ public class QueryServiceImpl implements QueryService { | |||
|     @Resource | ||||
|     private UniQueryDao uniQueryDao; | ||||
| 
 | ||||
|     @Resource | ||||
|     private UniColumnInfoDao uniColumnInfoDao; | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 查询万能查询的基本信息和条件信息 | ||||
|  | @ -96,21 +90,18 @@ public class QueryServiceImpl implements QueryService { | |||
|     @Override | ||||
|     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) | ||||
|     public Result<Integer> updateQueryInfo(UniQuery uniQuery) { | ||||
|         uniQueryDao.updateUniQuery(uniQuery); | ||||
|         if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) { | ||||
|             queryDao.deleteUniCon(uniQuery.getId()); | ||||
|             queryDao.insertUniCon(uniQuery.getUniCons()); | ||||
|             resetColumnInfo(uniQuery); | ||||
|         int uqrenewal = uniQueryDao.updateUniQuery(uniQuery); | ||||
|         if (uqrenewal > 0) { | ||||
|             if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) { | ||||
|                 queryDao.deleteUniCon(uniQuery.getId()); | ||||
|                 Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons()); | ||||
|                 if (ucrenewal == 0) { | ||||
|                     return Result.error(ReturnConstants.OP_ERROR); | ||||
|                 } | ||||
|             } | ||||
|             return Result.ok(); | ||||
|         } | ||||
|         return Result.ok(); | ||||
|     } | ||||
| 
 | ||||
|     void resetColumnInfo(UniQuery uniQuery){ | ||||
|         List<UniColumnInfo> infoList = uniQuery.getInfoList().stream().peek(info -> | ||||
|                 info.setQueryId(uniQuery.getId()) | ||||
|         ).collect(Collectors.toList()); | ||||
|         uniColumnInfoDao.deleteUniColumnInfo(uniQuery.getId()); | ||||
|         uniColumnInfoDao.insertUniColumnInfo(infoList); | ||||
|         return Result.error(ReturnConstants.OP_ERROR); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  |  | |||
|  | @ -15,7 +15,6 @@ | |||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <collection property="uniCons" javaType="java.util.List" notNullColumn="id" resultMap="UniConResult"/> | ||||
|         <collection property="infoList" javaType="java.util.List" notNullColumn="id" resultMap="UniColumnInfoResult"/> | ||||
|     </resultMap> | ||||
|     <resultMap type="com.ebts.generator.entity.UniCon" id="UniConResult"> | ||||
|         <result property="id"    column="uc_id"    /> | ||||
|  | @ -28,10 +27,6 @@ | |||
|         <result property="ucType"    column="uc_type"    /> | ||||
|         <result property="type"    column="type"    /> | ||||
|     </resultMap> | ||||
|     <resultMap type="com.ebts.generator.entity.UniColumnInfo" id="UniColumnInfoResult"> | ||||
|         <result property="prop"    column="prop"/> | ||||
|         <result property="label"    column="label"/> | ||||
|     </resultMap> | ||||
|     <select id="UniQuery" resultType="java.util.Map"> | ||||
|         ${paramSQL} | ||||
|     </select> | ||||
|  | @ -84,10 +79,9 @@ | |||
| 
 | ||||
|     <select id="selectQueryInfo" parameterType="Long" resultMap="QueryResult"> | ||||
|         select uq.id, uq.uq_name, uq.uq_sql, uq.uq_describe, uq.create_by, uq.is_release, uq.create_time, uq.update_by, uq.update_time, | ||||
|                uc.id as uc_id, uc.uq_id, uc.uc_name, uc.uc_key, uc.uc_con, uc.uc_mock, uc.uc_describe ,uc.uc_type,uc.type,uci.prop,uci.label | ||||
|                uc.id as uc_id, uc.uq_id, uc.uc_name, uc.uc_key, uc.uc_con, uc.uc_mock, uc.uc_describe ,uc.uc_type,uc.type | ||||
|         from gen_uni_query uq | ||||
|                 left join gen_uni_con uc on uc.uq_id = uq.id | ||||
|                 left join gen_uni_column_info uci on uci.query_id = uq.id | ||||
|                  left join gen_uni_con uc on uc.uq_id = uq.id | ||||
|         where uq.id = #{id} | ||||
|     </select> | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,16 +0,0 @@ | |||
| <?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.ebts.generator.dao.UniColumnInfoDao"> | ||||
| 
 | ||||
|     <insert id="insertUniColumnInfo" parameterType="java.util.List"> | ||||
|         insert into gen_uni_column_info (query_id,prop,label) values | ||||
|         <foreach collection="list" item="item" index="index" separator=","> | ||||
|             (#{item.queryId},#{item.prop},#{item.label}) | ||||
|         </foreach> | ||||
|     </insert> | ||||
|     <delete id="deleteUniColumnInfo"> | ||||
|         delete from gen_uni_column_info where query_id = #{queryId} | ||||
|     </delete> | ||||
| </mapper> | ||||
		Loading…
	
		Reference in New Issue