解决方案案例联查

main
mhsnet 1 year ago
parent f6f72ea7b2
commit a72d3e5afa

@ -27,10 +27,16 @@ public class SolutionController {
@ApiOperation(value="解决方案列表", notes="解决方案列表") @ApiOperation(value="解决方案列表", notes="解决方案列表")
@GetMapping("/list") @GetMapping("/list")
public Result<?> getStr() { public Result<?> getList() {
return Result.OK(this.solutionService.query().select("id","title","des","img","date","cases").eq("isshow","Y").list()); return Result.OK(this.solutionService.query().select("id","title","des","img","date","cases").eq("isshow","Y").list());
} }
@ApiOperation(value="解决方案列表含案例", notes="解决方案列表含案例")
@GetMapping("/list-all")
public Result<?> getListAll() {
return Result.OK(this.solutionService.getAll());
}
@ApiOperation(value="解决方案详情", notes="解决方案详情") @ApiOperation(value="解决方案详情", notes="解决方案详情")
@GetMapping("/info") @GetMapping("/info")
public Result<?> getInfo(@RequestParam(name="id",required=true) String id) { public Result<?> getInfo(@RequestParam(name="id",required=true) String id) {

@ -4,6 +4,8 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@ -31,6 +33,7 @@ import lombok.experimental.Accessors;
@ApiModel(value="yxgw_solution对象", description="解决方案") @ApiModel(value="yxgw_solution对象", description="解决方案")
public class Solution implements Serializable { public class Solution implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public List<Case> caseslist;
/**id*/ /**id*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ -71,7 +74,7 @@ public class Solution implements Serializable {
@Excel(name = "案例列表", width = 15, dictTable = "yxgw_case", dicText = "customer", dicCode = "id") @Excel(name = "案例列表", width = 15, dictTable = "yxgw_case", dicText = "customer", dicCode = "id")
@Dict(dictTable = "yxgw_case", dicText = "customer", dicCode = "id") @Dict(dictTable = "yxgw_case", dicText = "customer", dicCode = "id")
@ApiModelProperty(value = "案例列表") @ApiModelProperty(value = "案例列表")
private java.lang.String cases; public java.lang.String cases;
/**发布日期*/ /**发布日期*/
@Excel(name = "发布日期", width = 15, format = "yyyy-MM-dd") @Excel(name = "发布日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")

@ -1,8 +1,11 @@
package org.jeecg.modules.demo.yxgwf.mapper; package org.jeecg.modules.demo.yxgwf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.yxgwf.entity.Case; import org.jeecg.modules.demo.yxgwf.entity.Case;
import java.util.List;
/** /**
* @Description: * @Description:
* @Author: jeecg-boot * @Author: jeecg-boot
@ -11,4 +14,5 @@ import org.jeecg.modules.demo.yxgwf.entity.Case;
*/ */
public interface CaseMapper extends BaseMapper<Case> { public interface CaseMapper extends BaseMapper<Case> {
List<Case> getAll(@Param("caseIds") String[] caseIds);
} }

@ -2,7 +2,14 @@ package org.jeecg.modules.demo.yxgwf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
import org.jeecg.modules.demo.yxgwf.entity.Solution; import org.jeecg.modules.demo.yxgwf.entity.Solution;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface SolutionMapper extends BaseMapper<Solution> { public interface SolutionMapper extends BaseMapper<Solution> {
public List<Solution> getAll();
} }

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.CaseMapper"> <mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.CaseMapper">
<select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Case">
SELECT id,customer,title,industry,des,img,date
FROM yxgw_case
where id in
<foreach item="caseId" collection="caseIds"
open="(" separator="," close=")">
#{caseId}
</foreach>
</select>
</mapper> </mapper>

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.SolutionMapper"> <mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.SolutionMapper">
<select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution">
SELECT id,title,des,img,date,cases FROM yxgw_solution
</select>
</mapper> </mapper>

@ -3,5 +3,8 @@ package org.jeecg.modules.demo.yxgwf.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.demo.yxgwf.entity.Solution; import org.jeecg.modules.demo.yxgwf.entity.Solution;
import java.util.List;
public interface ISolutionService extends IService<Solution> { public interface ISolutionService extends IService<Solution> {
List<Solution> getAll();
} }

@ -1,11 +1,30 @@
package org.jeecg.modules.demo.yxgwf.service.impl; package org.jeecg.modules.demo.yxgwf.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.demo.yxgwf.entity.Case;
import org.jeecg.modules.demo.yxgwf.entity.Solution; import org.jeecg.modules.demo.yxgwf.entity.Solution;
import org.jeecg.modules.demo.yxgwf.mapper.CaseMapper;
import org.jeecg.modules.demo.yxgwf.mapper.SolutionMapper; import org.jeecg.modules.demo.yxgwf.mapper.SolutionMapper;
import org.jeecg.modules.demo.yxgwf.service.ISolutionService; import org.jeecg.modules.demo.yxgwf.service.ISolutionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
public class SolutionServiceImpl extends ServiceImpl<SolutionMapper, Solution> implements ISolutionService { public class SolutionServiceImpl extends ServiceImpl<SolutionMapper, Solution> implements ISolutionService {
@Autowired
private SolutionMapper solutionMapper;
@Autowired
private CaseMapper caseMapper;
public List<Solution> getAll() {
List<Solution> solution_list = solutionMapper.getAll();
solution_list.forEach((e) -> {
String[] caseIds = e.cases.split(",");
List<Case> case_list = caseMapper.getAll(caseIds);
e.caseslist = case_list;
});
return solution_list;
}
} }

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.CaseMapper"> <mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.CaseMapper">
<select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Case">
SELECT id,customer,title,industry,des,img,date
FROM yxgw_case
where id in
<foreach item="caseId" collection="caseIds"
open="(" separator="," close=")">
#{caseId}
</foreach>
</select>
</mapper> </mapper>

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.SolutionMapper"> <mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.SolutionMapper">
<select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution">
SELECT id,title,des,img,date,cases FROM yxgw_solution
</select>
</mapper> </mapper>
Loading…
Cancel
Save