Commit 558ff021 authored by 盖献康's avatar 盖献康

车企信息 - 接参

parent a0c2da41
package com.ruoyi.domain; package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -20,11 +23,13 @@ import com.ruoyi.common.core.domain.BaseEntity; ...@@ -20,11 +23,13 @@ import com.ruoyi.common.core.domain.BaseEntity;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(value = "车企信息对象") @ApiModel(value = "车企信息对象")
@TableName(value ="t_automobile_enterprise")
public class AutomobileEnterprise extends BaseEntity public class AutomobileEnterprise extends BaseEntity
{ {
/** 主键 */ /** 主键 */
@ApiModelProperty("ID") @ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_ID)
private Long id; private Long id;
/** 企业名称 */ /** 企业名称 */
......
package com.ruoyi.mapper; package com.ruoyi.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.AutomobileEnterprise; import com.ruoyi.domain.AutomobileEnterprise;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
...@@ -11,7 +14,7 @@ import org.springframework.stereotype.Repository; ...@@ -11,7 +14,7 @@ import org.springframework.stereotype.Repository;
* @date 2024-01-05 * @date 2024-01-05
*/ */
@Repository @Repository
public interface AutomobileEnterpriseMapper public interface AutomobileEnterpriseMapper extends BaseMapper<AutomobileEnterprise>
{ {
/** /**
* 查询车企信息 * 查询车企信息
...@@ -27,7 +30,7 @@ public interface AutomobileEnterpriseMapper ...@@ -27,7 +30,7 @@ public interface AutomobileEnterpriseMapper
* @param automobileEnterprise 车企信息 * @param automobileEnterprise 车企信息
* @return 车企信息集合 * @return 车企信息集合
*/ */
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterprise automobileEnterprise); public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request);
/** /**
* 新增车企信息 * 新增车企信息
......
package com.ruoyi.service; package com.ruoyi.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.AutomobileEnterprise; import com.ruoyi.domain.AutomobileEnterprise;
import org.apache.ibatis.annotations.Mapper; import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
/**
* 车企信息Service接口 public interface AutomobileEnterpriseService extends IService<AutomobileEnterprise>
*
* @author gxk
* @date 2024-01-05
*/
@Mapper
public interface AutomobileEnterpriseService
{ {
/** /**
* 查询车企信息 * 查询车企信息
...@@ -27,7 +23,7 @@ public interface AutomobileEnterpriseService ...@@ -27,7 +23,7 @@ public interface AutomobileEnterpriseService
* @param automobileEnterprise 车企信息 * @param automobileEnterprise 车企信息
* @return 车企信息集合 * @return 车企信息集合
*/ */
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterprise automobileEnterprise); public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request);
/** /**
* 新增车企信息 * 新增车企信息
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import java.util.Arrays;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.mapper.AutomobileEnterpriseMapper; import com.ruoyi.mapper.AutomobileEnterpriseMapper;
...@@ -18,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -18,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@Service @Service
@Transactional @Transactional
public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseService public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnterpriseMapper, AutomobileEnterprise> implements AutomobileEnterpriseService
{ {
@Autowired @Autowired
private AutomobileEnterpriseMapper automobileEnterpriseMapper; private AutomobileEnterpriseMapper automobileEnterpriseMapper;
...@@ -42,9 +46,9 @@ public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseServ ...@@ -42,9 +46,9 @@ public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseServ
* @return 车企信息 * @return 车企信息
*/ */
@Override @Override
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterprise automobileEnterprise) public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request)
{ {
return automobileEnterpriseMapper.selectAutomobileEnterpriseList(automobileEnterprise); return automobileEnterpriseMapper.selectAutomobileEnterpriseList(request);
} }
/** /**
...@@ -58,7 +62,8 @@ public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseServ ...@@ -58,7 +62,8 @@ public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseServ
{ {
automobileEnterprise.setCreateTime(DateUtils.getNowDate()); automobileEnterprise.setCreateTime(DateUtils.getNowDate());
automobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId())); automobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.insertAutomobileEnterprise(automobileEnterprise); automobileEnterprise.setDeleted(0);
return automobileEnterpriseMapper.insert(automobileEnterprise);
} }
/** /**
...@@ -84,7 +89,13 @@ public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseServ ...@@ -84,7 +89,13 @@ public class AutomobileEnterpriseServiceImpl implements AutomobileEnterpriseServ
@Override @Override
public int deleteAutomobileEnterpriseByIds(Long[] ids) public int deleteAutomobileEnterpriseByIds(Long[] ids)
{ {
return automobileEnterpriseMapper.deleteAutomobileEnterpriseByIds(ids); Arrays.stream(ids).forEach(id -> {
lambdaUpdate()
.eq(AutomobileEnterprise::getId, id)
.set(AutomobileEnterprise::getDeleted, 1)
.update();
});
return 1;
} }
/** /**
......
...@@ -3,9 +3,10 @@ package com.ruoyi.web; ...@@ -3,9 +3,10 @@ package com.ruoyi.web;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.web.request.AutomobileEnterpriseRequest; import com.ruoyi.web.request.AutomobileEnterpriseEditRequest;
import com.ruoyi.web.request.AutomobileEnterpriseGetInfoRequest;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -40,13 +41,12 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -40,13 +41,12 @@ public class AutomobileEnterpriseController extends BaseController
/** /**
* 查询车企信息列表 * 查询车企信息列表
*/ */
@Anonymous
@ApiOperation("分页查询车企信息列表") @ApiOperation("分页查询车企信息列表")
@PostMapping("/list") @PostMapping("/list")
public TableDataInfo<AutomobileEnterprise> list(AutomobileEnterprise automobileEnterprise) public TableDataInfo<AutomobileEnterprise> list(@Validated @RequestBody AutomobileEnterpriseListRequest request)
{ {
startPage(); startPage();
List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(automobileEnterprise); List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request);
return getDataTable(list); return getDataTable(list);
} }
...@@ -56,9 +56,9 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -56,9 +56,9 @@ public class AutomobileEnterpriseController extends BaseController
@Log(title = "车企信息", businessType = BusinessType.EXPORT) @Log(title = "车企信息", businessType = BusinessType.EXPORT)
@ApiOperation("导出车企信息列表") @ApiOperation("导出车企信息列表")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, AutomobileEnterprise automobileEnterprise) public void export(HttpServletResponse response, AutomobileEnterpriseListRequest request)
{ {
List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(automobileEnterprise); List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request);
ExcelUtil<AutomobileEnterprise> util = new ExcelUtil<AutomobileEnterprise>(AutomobileEnterprise.class); ExcelUtil<AutomobileEnterprise> util = new ExcelUtil<AutomobileEnterprise>(AutomobileEnterprise.class);
util.exportExcel(response, list, "车企信息数据"); util.exportExcel(response, list, "车企信息数据");
} }
...@@ -66,10 +66,9 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -66,10 +66,9 @@ public class AutomobileEnterpriseController extends BaseController
/** /**
* 获取车企信息详细信息 * 获取车企信息详细信息
*/ */
@Anonymous
@ApiOperation("获取车企信息详细信息") @ApiOperation("获取车企信息详细信息")
@PostMapping("/getById") @PostMapping("/getById")
public R<AutomobileEnterprise> getInfo(@Validated @RequestBody AutomobileEnterpriseRequest request) public R<AutomobileEnterprise> getInfo(@Validated @RequestBody AutomobileEnterpriseGetInfoRequest request)
{ {
return R.ok(automobileEnterpriseService.selectAutomobileEnterpriseById(request.getId())); return R.ok(automobileEnterpriseService.selectAutomobileEnterpriseById(request.getId()));
} }
...@@ -80,7 +79,7 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -80,7 +79,7 @@ public class AutomobileEnterpriseController extends BaseController
@ApiOperation("新增车企信息") @ApiOperation("新增车企信息")
@Log(title = "车企信息", businessType = BusinessType.INSERT) @Log(title = "车企信息", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
public R<Integer> add(@RequestBody AutomobileEnterprise automobileEnterprise) public R<Integer> add(@Validated @RequestBody AutomobileEnterprise automobileEnterprise)
{ {
return R.ok(automobileEnterpriseService.insertAutomobileEnterprise(automobileEnterprise)); return R.ok(automobileEnterpriseService.insertAutomobileEnterprise(automobileEnterprise));
} }
...@@ -91,7 +90,7 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -91,7 +90,7 @@ public class AutomobileEnterpriseController extends BaseController
@ApiOperation("修改车企信息") @ApiOperation("修改车企信息")
@Log(title = "车企信息", businessType = BusinessType.UPDATE) @Log(title = "车企信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
public R<Integer> edit(@RequestBody AutomobileEnterprise automobileEnterprise) public R<Integer> edit(@Validated @RequestBody AutomobileEnterprise automobileEnterprise)
{ {
return R.ok(automobileEnterpriseService.updateAutomobileEnterprise(automobileEnterprise)); return R.ok(automobileEnterpriseService.updateAutomobileEnterprise(automobileEnterprise));
} }
...@@ -102,7 +101,7 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -102,7 +101,7 @@ public class AutomobileEnterpriseController extends BaseController
@ApiOperation("删除车企信息") @ApiOperation("删除车企信息")
@Log(title = "车企信息", businessType = BusinessType.DELETE) @Log(title = "车企信息", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
public R<Integer> remove(@Validated @RequestBody AutomobileEnterpriseRequest request) public R<Integer> remove(@Validated @RequestBody AutomobileEnterpriseEditRequest request)
{ {
return R.ok(automobileEnterpriseService.deleteAutomobileEnterpriseByIds(request.getIds())); return R.ok(automobileEnterpriseService.deleteAutomobileEnterpriseByIds(request.getIds()));
} }
......
package com.ruoyi.web.request; package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -11,10 +10,7 @@ import lombok.Data; ...@@ -11,10 +10,7 @@ import lombok.Data;
*/ */
@Data @Data
@ApiModel @ApiModel
public class AutomobileEnterpriseRequest extends PageDomain { public class AutomobileEnterpriseEditRequest {
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("车企ID集合") @ApiModelProperty("车企ID集合")
private Long[] ids; private Long[] ids;
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 获取车企信息详细信息DTO
* @author gxk
*/
@Data
@ApiModel
public class AutomobileEnterpriseGetInfoRequest {
@ApiModelProperty("ID")
private Long id;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 车企信息分页查询DTO
* @author gxk
*/
@Data
@ApiModel
public class AutomobileEnterpriseListRequest extends PageDomain {
/** 企业名称 */
@ApiModelProperty("企业名称")
private String enterpriseName;
/** 地址 */
@ApiModelProperty("地址")
private String address;
/** 邮编 */
@ApiModelProperty("邮编")
private String postcode;
/** 企业联系人 */
@ApiModelProperty("企业联系人")
private String enterpriseContact;
/** 联系电话 */
@ApiModelProperty("联系电话")
private String contactNumber;
}
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
<if test="enterpriseName != null and enterpriseName != ''">and enterprise_name like concat('%', <if test="enterpriseName != null and enterpriseName != ''">and enterprise_name like concat('%',
#{enterpriseName}, '%') #{enterpriseName}, '%')
</if> </if>
<if test="address != null and address != ''">and address = #{address}</if> <if test="address != null and address != ''">and address like concat('%', #{address}, '%')</if>
<if test="postcode != null and postcode != ''">and postcode = #{postcode}</if> <if test="postcode != null and postcode != ''">and postcode like concat('%', #{postcode}, '%')</if>
<if test="enterpriseContact != null and enterpriseContact != ''">and enterprise_contact = <if test="enterpriseContact != null and enterpriseContact != ''">
#{enterpriseContact} and enterprise_contact like concat('%', #{enterpriseContact}, '%')
</if> </if>
<if test="contactNumber != null and contactNumber != ''">and contact_number = #{contactNumber}</if> <if test="contactNumber != null and contactNumber != ''">and contact_number like('%', #{contactNumber}, '%')</if>
</where> </where>
</select> </select>
......
...@@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; ...@@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
/** /**
* Entity基类 * Entity基类
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseEntity implements Serializable public class BaseEntity implements Serializable
...@@ -38,7 +38,7 @@ public class BaseEntity implements Serializable ...@@ -38,7 +38,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */ /** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.UPDATE)
private Date updateTime; private Date updateTime;
/** 备注 */ /** 备注 */
......
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