13 changed files with 264 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:04 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "项目状态字典", description = "项目状态字典") |
|||
@TableName("project_state_dictionary") |
|||
public class ProjectStateDictionary extends BaseEntity { |
|||
//状态名
|
|||
private String name; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:04 |
|||
*/ |
|||
@Data |
|||
public class ProjectStateDictionaryDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
//状态名
|
|||
private String name; |
|||
//状态说明
|
|||
private String remarks; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:05 |
|||
*/ |
|||
@Mapper |
|||
public interface ProjectStateDictionaryMapper extends BaseMapper<ProjectStateDictionary> { |
|||
IPage<ProjectStateDictionaryVo> selectPageVo(IPage<ProjectStateDictionary> page, @Param(Constants.WRAPPER) Wrapper<ProjectStateDictionary> qw); |
|||
|
|||
@Select("select * from project_state_dictionary") |
|||
List<ProjectStateDictionaryVo> listAll(); |
|||
|
|||
@Select("select * from project_state_dictionary where sid=#{sid}") |
|||
ProjectStateDictionaryVo getProjectStateBySid(@Param("sid")String sid); |
|||
} |
@ -0,0 +1,15 @@ |
|||
<?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.yxt.supervise.crm.biz.projectstatedictionary.ProjectStateDictionaryMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
<select id="selectPageVo" resultType="com.yxt.supervise.crm.biz.projectstatedictionary.ProjectStateDictionaryVo"> |
|||
SELECT |
|||
* |
|||
FROM |
|||
project_state_dictionary |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:05 |
|||
*/ |
|||
@Data |
|||
public class ProjectStateDictionaryQuery implements Query { |
|||
private String id; |
|||
private String sid; |
|||
private String name; |
|||
private String remarks; |
|||
} |
@ -0,0 +1,58 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:06 |
|||
*/ |
|||
@Api(tags = "项目状态字典") |
|||
@RestController |
|||
@RequestMapping("projectstatedictionary") |
|||
public class ProjectStateDictionaryRest { |
|||
@Autowired |
|||
ProjectStateDictionaryService projectStateDictionaryService; |
|||
@ApiOperation("根据条件分页查询数据的列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<ProjectStateDictionaryVo>> listPage(@RequestBody PagerQuery<ProjectStateDictionaryQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
PagerVo<ProjectStateDictionaryVo> pv = projectStateDictionaryService.listPageVo(pq); |
|||
return rb.success().setData(pv); |
|||
} |
|||
@ApiOperation("保存") |
|||
@PostMapping("/save") |
|||
public ResultBean save(@RequestBody ProjectStateDictionaryDto dto) { |
|||
return projectStateDictionaryService.save(dto); |
|||
} |
|||
@ApiOperation("查询全部") |
|||
@GetMapping("/listAll") |
|||
public ResultBean<List<ProjectStateDictionaryVo>> listAll() { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<ProjectStateDictionaryVo> list =projectStateDictionaryService.listAll(); |
|||
return rb.success().setData(list); |
|||
} |
|||
@ApiOperation("修改") |
|||
@PostMapping("/update") |
|||
public ResultBean update(@RequestBody ProjectStateDictionaryDto dto) { |
|||
return projectStateDictionaryService.update(dto); |
|||
} |
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable String sid) { |
|||
return projectStateDictionaryService.delete(sid); |
|||
} |
|||
@ApiOperation("根据sid查询") |
|||
@GetMapping("/getProjectStateBySid/{sid}") |
|||
public ResultBean selectStoreBySid (@PathVariable String sid){ |
|||
ResultBean r=projectStateDictionaryService.getProjectStateBySid(sid); |
|||
return r; |
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:05 |
|||
*/ |
|||
@Service |
|||
public class ProjectStateDictionaryService extends MybatisBaseService<ProjectStateDictionaryMapper,ProjectStateDictionary> { |
|||
|
|||
public PagerVo<ProjectStateDictionaryVo> listPageVo(PagerQuery<ProjectStateDictionaryQuery> pq) { |
|||
ProjectStateDictionaryQuery query = pq.getParams(); |
|||
QueryWrapper<ProjectStateDictionary> qw = new QueryWrapper<>(); |
|||
if(StringUtils.isNotBlank(query.getName())){ |
|||
qw.like("name",query.getName()); |
|||
} |
|||
// if(StringUtils.isNotBlank(query.getProjectType())){
|
|||
// qw.like("td.projectType",query.getProjectType());
|
|||
// }
|
|||
// if(StringUtils.isNotBlank(query.getBankName())){
|
|||
// qw.like("bank.bankName",query.getBankName());
|
|||
// }
|
|||
IPage<ProjectStateDictionary> page = PagerUtil.queryToPage(pq); |
|||
IPage<ProjectStateDictionaryVo> pagging = baseMapper.selectPageVo(page, qw); |
|||
PagerVo<ProjectStateDictionaryVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return p; |
|||
} |
|||
public List<ProjectStateDictionaryVo> listAll() { |
|||
List<ProjectStateDictionaryVo> pagging = baseMapper.listAll(); |
|||
return pagging; |
|||
} |
|||
public ResultBean save(ProjectStateDictionaryDto dto) { |
|||
ResultBean rb=new ResultBean(); |
|||
ProjectStateDictionary entity=new ProjectStateDictionary(); |
|||
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|||
baseMapper.insert(entity); |
|||
return rb.success().setMsg("保存项目信息成功"); |
|||
} |
|||
@Transactional |
|||
public ResultBean update(ProjectStateDictionaryDto dto) { |
|||
ResultBean rb=new ResultBean(); |
|||
String dtoSid = dto.getSid(); |
|||
ProjectStateDictionary entity=fetchBySid(dtoSid); |
|||
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|||
baseMapper.updateById(entity); |
|||
return rb.success().setMsg("修改项目信息成功"); |
|||
} |
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb=new ResultBean(); |
|||
baseMapper.delete(new QueryWrapper<ProjectStateDictionary>().eq("sid",sid)); |
|||
return rb.success().setMsg("删除项目信息成功"); |
|||
} |
|||
public ResultBean getProjectStateBySid(String sid) { |
|||
ResultBean rb=new ResultBean(); |
|||
ProjectStateDictionaryVo projectStateBySid=baseMapper.getProjectStateBySid(sid); |
|||
return rb.success().setData(projectStateBySid); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.yxt.supervise.crm.biz.projectstatedictionary; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/10/16 10:05 |
|||
*/ |
|||
@Data |
|||
public class ProjectStateDictionaryVo implements Query { |
|||
private String id; |
|||
private String sid; |
|||
private String name; |
|||
private String remarks; |
|||
} |
Loading…
Reference in new issue