Bingbing před 4 roky
rodič
revize
7dc9fef04a

+ 3 - 2
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlCompanyCaseController.java

@ -48,11 +48,12 @@ public class ZjxlCompanyCaseController extends BaseController {
    @ApiOperation(value = "查看CompanyCase")
    public String findCompanyCaseById(@ApiParam(name = "id", value = "companyId", required = false) @RequestParam(value = "id", required = false)String id,
                                      @ApiParam(name = "name", value = "companyName", required = false) @RequestParam(value = "name", required = false)String name,
                                      @ApiParam(name = "lineStatus", value = "上线状态0 不上线 1上线 ", required = false) @RequestParam(value = "lineStatus", defaultValue ="",required = false)String lineStatus,
                                      @ApiParam(name = "pageNo", value = "第几页", defaultValue = "1") @RequestParam(value = "pageNo", required = false) Integer pageNo,
                                      @ApiParam(name = "pageSize", value = "分页大小", defaultValue = "10") @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            List<ZjxlCompanyCase> companyCaseList = companyCaseService.findById(id,name,pageNo-1,pageSize*pageNo);
            return write(200,"查询成功","data", PageUtil.getPage(companyCaseList,pageNo,pageSize,companyCaseService.allCount()));
            List<ZjxlCompanyCase> companyCaseList = companyCaseService.findById(id,name,lineStatus,pageNo-1,pageSize*pageNo);
            return write(200,"查询成功","data", PageUtil.getPage(companyCaseList,pageNo,pageSize,companyCaseService.allCount(id,name,lineStatus)));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");

+ 15 - 3
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlCompanyCaseService.java

@ -29,7 +29,7 @@ public class ZjxlCompanyCaseService extends BaseService {
    @Autowired
    JdbcTemplate jdbcTemplate;
    public List<ZjxlCompanyCase> findById(String id, String name, Integer page, Integer pagesize){
    public List<ZjxlCompanyCase> findById(String id, String name,String lineStatus,Integer page, Integer pagesize){
        String sql = "select a.* from zjxl_company_case a where 1=1";
        if (StringUtils.isNotEmpty(id)){
            sql += " and company_id = '"+id+"'";
@ -37,13 +37,25 @@ public class ZjxlCompanyCaseService extends BaseService {
        if (StringUtils.isNotEmpty(name)){
            sql += " and company_name like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(lineStatus)){
            sql += " and company_is_line ='"+lineStatus+"' ";
        }
        sql += " order by company_sort asc,company_create_time DESC limit "+page+" , "+pagesize+"";
        List<ZjxlCompanyCase> companyCaseList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlCompanyCase.class));
        return companyCaseList;
    }
    public int allCount(){
        String sql = "select count(*) from zjxl_company_case ";
    public int allCount(String id, String name,String lineStatus){
        String sql = "select count(*) from zjxl_company_case a where 1=1";
        if (StringUtils.isNotEmpty(id)){
            sql += " and company_id = '"+id+"'";
        }
        if (StringUtils.isNotEmpty(name)){
            sql += " and company_name like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(lineStatus)){
            sql += " and company_is_line ='"+lineStatus+"' ";
        }
        Integer allCount = jdbcTemplate.queryForObject(sql, Integer.class);;
        return allCount;
    }