New file |
| | |
| | | package com.ycl.system; |
| | | |
| | | import org.springframework.lang.NonNull; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | |
| | | /** |
| | | * 新的响应类 |
| | | * @author xp |
| | | * @date 2022/12/2 |
| | | */ |
| | | public class Result extends HashMap<String, Object> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private static final String TOTAL = "total"; |
| | | |
| | | public static final String DATA = "data"; |
| | | |
| | | private static final String MSG = "msg"; |
| | | |
| | | private static final String CODE = "code"; |
| | | |
| | | public Result() { |
| | | put(MSG, "success"); |
| | | put(CODE, 200); |
| | | } |
| | | |
| | | /** |
| | | * 成功,啥也不做 |
| | | * @return |
| | | */ |
| | | public static Result ok() { |
| | | return new Result(); |
| | | } |
| | | |
| | | /** |
| | | * 成功,自定义提示信息 |
| | | * @param msg |
| | | * @return |
| | | */ |
| | | public static Result ok(String msg) { |
| | | Result result = new Result(); |
| | | result.put(MSG, msg); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,啥也不做 |
| | | * @return |
| | | */ |
| | | public static Result error() { |
| | | Result result = new Result(); |
| | | result.put(CODE, 500); |
| | | result.put(MSG, "操作失败"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,自定义错误提示 |
| | | * @param msg |
| | | * @return |
| | | */ |
| | | public static Result error(String msg) { |
| | | Result result = new Result(); |
| | | result.put(CODE, 500); |
| | | result.put(MSG, msg); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,自定义错误码 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static Result error(@NonNull Integer code) { |
| | | Result result = new Result(); |
| | | result.put(CODE, code); |
| | | result.put(MSG, "操作失败"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,自定义错误码和错误提示 |
| | | * @param code |
| | | * @param msg |
| | | * @return |
| | | */ |
| | | public static Result error(@NonNull Integer code, String msg) { |
| | | Result result = new Result(); |
| | | result.put(CODE, code); |
| | | result.put(MSG, msg); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public Result data(Object data) { |
| | | this.put(DATA, data); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 添加总条数 |
| | | * @param total |
| | | * @return |
| | | */ |
| | | public Result total(long total) { |
| | | this.put(TOTAL, total); |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public Result put(String key, Object value) { |
| | | super.put(key, value); |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ycl.system.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ycl.system.domain.base.AbsEntity; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 运维单位 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("t_yw_unit") |
| | | @ApiModel(value = "YwUnit对象", description = "运维单位") |
| | | public class YwUnit extends AbsEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("单位编码") |
| | | @TableField("unit_code") |
| | | private String unitCode; |
| | | |
| | | @ApiModelProperty("单位名称") |
| | | @TableField("unit_name") |
| | | private String unitName; |
| | | |
| | | @ApiModelProperty("单位联系人") |
| | | @TableField("unit_contact") |
| | | private String unitContact; |
| | | |
| | | @ApiModelProperty("单位联系人电话") |
| | | @TableField("unit_contact_phone") |
| | | private String unitContactPhone; |
| | | |
| | | @ApiModelProperty("单位管理员账号") |
| | | @TableField("unit_admin_account") |
| | | private String unitAdminAccount; |
| | | |
| | | @ApiModelProperty("备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.system.domain.form; |
| | | |
| | | import com.ycl.system.domain.entity.YwUnit; |
| | | import com.ycl.system.domain.group.Update; |
| | | import com.ycl.system.domain.group.Add; |
| | | import com.ycl.system.domain.base.AbsForm; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.lang.NonNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 运维单位表单 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "YwUnit表单", description = "运维单位表单") |
| | | public class YwUnitForm extends AbsForm { |
| | | |
| | | @NotBlank(message = "单位编码不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("单位编码") |
| | | private String unitCode; |
| | | |
| | | @NotBlank(message = "单位名称不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("单位名称") |
| | | private String unitName; |
| | | |
| | | @NotBlank(message = "单位联系人不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("单位联系人") |
| | | private String unitContact; |
| | | |
| | | @NotBlank(message = "单位联系人电话不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("单位联系人电话") |
| | | private String unitContactPhone; |
| | | |
| | | @NotBlank(message = "单位管理员账号不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("单位管理员账号") |
| | | private String unitAdminAccount; |
| | | |
| | | @NotBlank(message = "备注不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | |
| | | public static YwUnit getEntityByForm(@NonNull YwUnitForm form, YwUnit entity) { |
| | | if(entity == null) { |
| | | entity = new YwUnit(); |
| | | } |
| | | BeanUtils.copyProperties(form, entity); |
| | | return entity; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.system.domain.query; |
| | | |
| | | import com.ycl.system.domain.base.AbsQuery; |
| | | import java.util.List; |
| | | import org.springframework.lang.NonNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 运维单位查询 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "YwUnit查询", description = "运维单位查询") |
| | | public class YwUnitQuery extends AbsQuery { |
| | | } |
| | | |
New file |
| | |
| | | package com.ycl.system.domain.vo; |
| | | |
| | | import com.ycl.system.domain.base.AbsVo; |
| | | import java.util.List; |
| | | |
| | | import com.ycl.system.domain.entity.YwUnit; |
| | | import org.springframework.lang.NonNull; |
| | | import org.springframework.beans.BeanUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 运维单位展示 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class YwUnitVO extends AbsVo { |
| | | |
| | | /** 单位编码 */ |
| | | private String unitCode; |
| | | |
| | | /** 单位名称 */ |
| | | private String unitName; |
| | | |
| | | /** 单位联系人 */ |
| | | private String unitContact; |
| | | |
| | | /** 单位联系人电话 */ |
| | | private String unitContactPhone; |
| | | |
| | | /** 单位管理员账号 */ |
| | | private String unitAdminAccount; |
| | | |
| | | /** 备注 */ |
| | | private String remark; |
| | | |
| | | public static YwUnitVO getVoByEntity(@NonNull YwUnit entity, YwUnitVO vo) { |
| | | if(vo == null) { |
| | | vo = new YwUnitVO(); |
| | | } |
| | | BeanUtils.copyProperties(entity, vo); |
| | | return vo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.system.page; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ycl.system.domain.base.AbsEntity; |
| | | import com.ycl.system.domain.base.AbsQuery; |
| | | |
| | | /** |
| | | * 分页工具类 |
| | | * @author xp |
| | | * @date 2022/12/2 |
| | | */ |
| | | public class PageUtil { |
| | | |
| | | /** |
| | | * 获取plus的分页对象 |
| | | * @param q |
| | | * @param <T> 实体类 |
| | | * @param <Q> 查询类 |
| | | * @return |
| | | */ |
| | | public static <T extends AbsEntity, Q extends AbsQuery> IPage<T> getPage(Q q, Class<T> c) { |
| | | Page<T> page = new Page<T>() |
| | | .setCurrent(q.getCurrentPage()) |
| | | .setSize(q.getPageSize()); |
| | | return page; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.system.controller.zgyw; |
| | | |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.domain.form.YwUnitForm; |
| | | import com.ycl.system.domain.group.Update; |
| | | import com.ycl.system.domain.group.Add; |
| | | import com.ycl.system.domain.query.YwUnitQuery; |
| | | import com.ycl.system.service.YwUnitService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * 运维单位 前端控制器 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @Api(value = "运维单位", tags = "运维单位管理") |
| | | @RestController |
| | | @RequestMapping("/yw-unit") |
| | | public class YwUnitController { |
| | | |
| | | private final YwUnitService ywUnitService; |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加", notes = "添加") |
| | | public Result add(@RequestBody @Validated(Add.class) YwUnitForm form) { |
| | | return ywUnitService.add(form); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public Result update(@RequestBody @Validated(Update.class) YwUnitForm form) { |
| | | return ywUnitService.update(form); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "ID删除", notes = "ID删除") |
| | | public Result removeById(@PathVariable("id") String id) { |
| | | return ywUnitService.removeById(id); |
| | | } |
| | | |
| | | @DeleteMapping("/batch") |
| | | @ApiOperation(value = "批量删除", notes = "批量删除") |
| | | public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) { |
| | | return ywUnitService.remove(ids); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "分页", notes = "分页") |
| | | public Result page(YwUnitQuery query) { |
| | | return ywUnitService.page(query); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public Result detail(@PathVariable("id") String id) { |
| | | return ywUnitService.detail(id); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "列表", notes = "列表") |
| | | public Result list() { |
| | | return ywUnitService.all(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ycl.system.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import java.util.List; |
| | | |
| | | import com.ycl.system.domain.entity.YwUnit; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * 运维单位 Mapper 接口 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Mapper |
| | | public interface YwUnitMapper extends BaseMapper<YwUnit> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.domain.entity.YwUnit; |
| | | import com.ycl.system.domain.form.YwUnitForm; |
| | | import com.ycl.system.domain.query.YwUnitQuery; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 运维单位 服务类 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | public interface YwUnitService extends IService<YwUnit> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result add(YwUnitForm form); |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result update(YwUnitForm form); |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | Result remove(List<String> ids); |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result removeById(String id); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Result page(YwUnitQuery query); |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result detail(String id); |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | Result all(); |
| | | } |
New file |
| | |
| | | package com.ycl.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.util.List; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.domain.entity.YwUnit; |
| | | import com.ycl.system.domain.form.YwUnitForm; |
| | | import com.ycl.system.domain.query.YwUnitQuery; |
| | | import com.ycl.system.domain.vo.YwUnitVO; |
| | | import com.ycl.system.mapper.YwUnitMapper; |
| | | import com.ycl.system.page.PageUtil; |
| | | import com.ycl.system.service.YwUnitService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.Assert; |
| | | import java.util.stream.Collectors; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | /** |
| | | * 运维单位 服务实现类 |
| | | * |
| | | * @author xp |
| | | * @since 2024-03-04 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class YwUnitServiceImpl extends ServiceImpl<YwUnitMapper, YwUnit> implements YwUnitService { |
| | | |
| | | private final YwUnitMapper ywUnitMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result add(YwUnitForm form) { |
| | | YwUnit entity = YwUnitForm.getEntityByForm(form, null); |
| | | if(baseMapper.insert(entity) > 0) { |
| | | return Result.ok("添加成功"); |
| | | } |
| | | return Result.error("添加失败"); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result update(YwUnitForm form) { |
| | | |
| | | YwUnit entity = baseMapper.selectById(form.getId()); |
| | | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | if (baseMapper.updateById(entity) > 0) { |
| | | return Result.ok("修改成功"); |
| | | } |
| | | return Result.error("修改失败"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result remove(List<String> ids) { |
| | | if(baseMapper.deleteBatchIds(ids) > 0) { |
| | | return Result.ok("删除成功"); |
| | | } |
| | | return Result.error("删除失败"); |
| | | } |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result removeById(String id) { |
| | | if(baseMapper.deleteById(id) > 0) { |
| | | return Result.ok("删除成功"); |
| | | } |
| | | return Result.error("删除失败"); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result page(YwUnitQuery query) { |
| | | |
| | | IPage<YwUnit> page = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .orderByDesc(YwUnit::getCreateTime) |
| | | .page(PageUtil.getPage(query, YwUnit.class)); |
| | | |
| | | List<YwUnitVO> vos = page.getRecords().stream() |
| | | .map( |
| | | entity -> YwUnitVO.getVoByEntity(entity, null) |
| | | ) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos).total(page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result detail(String id) { |
| | | |
| | | YwUnit entity = baseMapper.selectById(id); |
| | | Assert.notNull(entity, "记录不存在"); |
| | | YwUnitVO vo = YwUnitVO.getVoByEntity(entity, null); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result all() { |
| | | List<YwUnit> entities = baseMapper.selectList(null); |
| | | List<YwUnitVO> vos = entities.stream() |
| | | .map( |
| | | entity -> YwUnitVO.getVoByEntity(entity, null) |
| | | ) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | } |
New file |
| | |
| | | <?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.ycl.system.mapper.YwUnitMapper"> |
| | | |
| | | <resultMap type="YwUnit" id="YwUnitResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="unitCode" column="unit_code" /> |
| | | <result property="unitName" column="unit_name" /> |
| | | <result property="unitContact" column="unit_contact" /> |
| | | <result property="unitContactPhone" column="unit_contact_phone" /> |
| | | <result property="unitAdminAccount" column="unit_admin_account" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="deleted" column="deleted" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectYwUnitVo"> |
| | | select id, unit_code, unit_name, unit_contact, unit_contact_phone, unit_admin_account, remark, create_time, update_time, deleted from t_yw_unit |
| | | </sql> |
| | | |
| | | <select id="selectYwUnitList" parameterType="YwUnit" resultMap="YwUnitResult"> |
| | | <include refid="selectYwUnitVo"/> |
| | | <where> |
| | | <if test="unitCode != null and unitCode != ''"> and unit_code = #{unitCode}</if> |
| | | <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if> |
| | | <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectYwUnitById" parameterType="Long" resultMap="YwUnitResult"> |
| | | <include refid="selectYwUnitVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertYwUnit" parameterType="YwUnit" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_yw_unit |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="unitCode != null and unitCode != ''">unit_code,</if> |
| | | <if test="unitName != null and unitName != ''">unit_name,</if> |
| | | <if test="unitContact != null and unitContact != ''">unit_contact,</if> |
| | | <if test="unitContactPhone != null and unitContactPhone != ''">unit_contact_phone,</if> |
| | | <if test="unitAdminAccount != null and unitAdminAccount != ''">unit_admin_account,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="deleted != null">deleted,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="unitCode != null and unitCode != ''">#{unitCode},</if> |
| | | <if test="unitName != null and unitName != ''">#{unitName},</if> |
| | | <if test="unitContact != null and unitContact != ''">#{unitContact},</if> |
| | | <if test="unitContactPhone != null and unitContactPhone != ''">#{unitContactPhone},</if> |
| | | <if test="unitAdminAccount != null and unitAdminAccount != ''">#{unitAdminAccount},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="deleted != null">#{deleted},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateYwUnit" parameterType="YwUnit"> |
| | | update t_yw_unit |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="unitCode != null and unitCode != ''">unit_code = #{unitCode},</if> |
| | | <if test="unitName != null and unitName != ''">unit_name = #{unitName},</if> |
| | | <if test="unitContact != null and unitContact != ''">unit_contact = #{unitContact},</if> |
| | | <if test="unitContactPhone != null and unitContactPhone != ''">unit_contact_phone = #{unitContactPhone},</if> |
| | | <if test="unitAdminAccount != null and unitAdminAccount != ''">unit_admin_account = #{unitAdminAccount},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="deleted != null">deleted = #{deleted},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteYwUnitById" parameterType="Long"> |
| | | delete from t_yw_unit where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteYwUnitByIds" parameterType="String"> |
| | | delete from t_yw_unit where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |