Commit c179a05f authored by hezhen's avatar hezhen

添加门店列表

parent 237b290c
package com.xxfc.platform.vehicle.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Data
@Table(name = "company_info")
public class CompanyInfo {
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("公司名称")
private String name;
@ApiModelProperty("法人姓名")
@Column(name = "legal_person")
private String legalPerson;
@ApiModelProperty("公司名称")
@Column(name = "legal_id_number")
private String legalIdNumber;
@ApiModelProperty("联系人")
private String contact;
@ApiModelProperty("联系电话")
private String mobile;
@ApiModelProperty("营业执照")
@Column(name = "business_license")
private String businessLicense;
@Column(name = "crt_time")
private Long crtTime;
@Column(name = "upd_time")
private Long updTime;
@Column(name = "is_del")
private Integer isDel;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.pojo.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class CompanyInfoFindDTO extends PageParam {
private String name;
}
package com.xxfc.platform.vehicle.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import com.xxfc.platform.vehicle.mapper.CompanyInfoMapper;
import com.xxfc.platform.vehicle.pojo.dto.CompanyInfoFindDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Service
@Slf4j
public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
public ObjectRestResponse addOrUpd(CompanyInfo companyInfo){
Long id = companyInfo.getId() == null ? 0L :companyInfo.getId();
if (id > 0L){
updateSelectiveById(companyInfo);
}else {
insertSelective(companyInfo);
}
return ObjectRestResponse.succ();
}
public List<CompanyInfo> getList(CompanyInfoFindDTO companyInfoFindDTO){
Example example=new Example(CompanyInfo.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotBlank(companyInfoFindDTO.getName()) ){
criteria.andLike("name","%" + companyInfoFindDTO.getName() + "%");
}
example.setOrderByClause("crt_time desc ");
return selectByExample(example);
}
public ObjectRestResponse selectList(CompanyInfoFindDTO companyInfoFindDTO){
PageHelper.startPage(companyInfoFindDTO.getPage(), companyInfoFindDTO.getLimit());
PageInfo<CompanyInfo> pageInfo = new PageInfo<>(getList(companyInfoFindDTO));
return ObjectRestResponse.succ(PageDataVO.pageInfo(pageInfo));
}
}
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface CompanyInfoMapper extends Mapper<CompanyInfo>, SelectByIdListMapper<CompanyInfo,Long> {
}
\ No newline at end of file
package com.xxfc.platform.vehicle.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.biz.CompanyInfoBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import com.xxfc.platform.vehicle.pojo.dto.CompanyInfoFindDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("company/info")
public class CompanyInfoController extends BaseController<CompanyInfoBiz> {
@ApiOperation("查询公司列表")
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
public ObjectRestResponse getList(CompanyInfoFindDTO companyInfoFindDTO){
return baseBiz.selectList(companyInfoFindDTO);
}
@ApiOperation("新增公司")
@RequestMapping(value = "/save", method = RequestMethod.POST)
public ObjectRestResponse saveCompany(@RequestBody CompanyInfo companyInfo){
return baseBiz.addOrUpd(companyInfo);
}
@ApiOperation("更新公司")
@RequestMapping(value = "/upd", method = RequestMethod.POST)
public ObjectRestResponse updCompany(@RequestBody CompanyInfo companyInfo){
return baseBiz.addOrUpd(companyInfo);
}
@ApiOperation("删除")
@RequestMapping(value = "/del", method = RequestMethod.POST)
public ObjectRestResponse delCompany(@RequestBody CompanyInfo companyInfo){
companyInfo.setIsDel(1);
return baseBiz.addOrUpd(companyInfo);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment